On Fri, Sep 26, 2008 at 03:45:49PM +1000, Lachlan McIlroy wrote:
> p v wrote:
>> Let's say that I did lseek/writev 10x - if I crash
>> after that according to the FAQ I can get NULLs in the file
>> - but - can I get it only at the end of the file or is it
>> possible to get NULLs in the middle as well? I could modify
>> my application to recover if it was only at the end
>> (ftruncate up to the last initialized data in the file) but
>> I cannot traverse the whole file and I don't want to
>> create checkpoints by doing fdatasync from time to time (at
>> that point I would consider to go up to the fixed version of
> Good question. I think you could get gaps of NULLs in the start
> or middle of the file if the VM flushed data from the middle or
> end of the file first and then the inode was updated on disk.
> Since data at the start of the file has not been written out
> yet then no extents may have been allocated there yet either.
> That's just a guess though - I don't know if it could actually
> happen that way.
Yes, you can certainly still get NULLs in the middle of the file.
It just depends on the timing and writeback patterns. if you are
in low memory conditions, the VM will do random page writeback
which means that there is no guarantee which page gets written