Daniel Ramsbrock
2005-11-23 22:00:02 UTC
What should happen in the following four scenarios?
1. An empty file is opened, and a seek to position 20,000 occurs,
followed by a WRITE request for 50 bytes.
2. An empty file is opened, and a seek to position 20,000 occurs,
followed by a READ request for 50 bytes.
3. A file of length 400 is opened, and a seek to position 20,400 occurs,
followed by a WRITE request for 50 bytes.
4. A file of length 400 is opened, and a seek to position 20,400 occurs,
followed by a READ request for 50 bytes.
I'm thinking that 1 and 3 really boil down to the same principle
(accessing past EOF, regardless of file size), as do 2 and 4, but I
wanted to make sure there is no distinction.
I'm guessing that in 1 and 3, we should at least allocate the block
where the write is happening. What about the blocks before it? Do we
leave them deallocated or do we allocate them and zero them out? If we
leave them deallocated, what happens later when there is a read request
for one of those blocks? What about a write request?
My guess is that for 2 and 4, we should return an error (since trying to
read information past the end of the file seems like an illegal operation).
What about the case where the read/write request is longer than 4096
bytes (one GOSFS block)?
Thanks, and happy Thanksgiving to everyone,
Daniel
1. An empty file is opened, and a seek to position 20,000 occurs,
followed by a WRITE request for 50 bytes.
2. An empty file is opened, and a seek to position 20,000 occurs,
followed by a READ request for 50 bytes.
3. A file of length 400 is opened, and a seek to position 20,400 occurs,
followed by a WRITE request for 50 bytes.
4. A file of length 400 is opened, and a seek to position 20,400 occurs,
followed by a READ request for 50 bytes.
I'm thinking that 1 and 3 really boil down to the same principle
(accessing past EOF, regardless of file size), as do 2 and 4, but I
wanted to make sure there is no distinction.
I'm guessing that in 1 and 3, we should at least allocate the block
where the write is happening. What about the blocks before it? Do we
leave them deallocated or do we allocate them and zero them out? If we
leave them deallocated, what happens later when there is a read request
for one of those blocks? What about a write request?
My guess is that for 2 and 4, we should return an error (since trying to
read information past the end of the file seems like an illegal operation).
What about the case where the read/write request is longer than 4096
bytes (one GOSFS block)?
Thanks, and happy Thanksgiving to everyone,
Daniel