Ming, the short answer to your original question is that xfs will not give you
back any data that was not explicitly written to the file. Feel free to seek,
allocate, write, truncate, open, close etc to your heart's content. Do a read,
and you will get back either 0s, or data that you wrote.
Run fsx over xfs for a while to convince yourself of this.
Ming Zhang wrote:
i finished the reading on related section in ULK and i think i knew why
my wrong understanding is wrong now.
preallocation is not a persistent action that give the space to file
persistently. in fact, it is preserved to that file and if there are
write operations on that file, the prealloated space will possibly be
used. if nothing happen on that file, file closed, or truncated, that
preallocated is freed and maybe new preallocation will be given later.
so if there is no write on certain offset, but a seek over it, it will
form a hole in that area and no physical storage back it.
hope i have a right understanding now.
so a read will check inode and find out that no space available for that
file block (corresponding disk lba is 0), then it knows it met a hole.
could u tell me in which function in xfs code handle this?