On 01/08/2018 08:54 AM, Joerg Schilling wrote:
The most important fact however is that allocating spade happens before you
copy data into that space.
Certainly users need the ability to make sure there's enough room before
starting to copy, and POSIX allows for that with posix_fallocate.
However, I don't see any POSIX requirement that st_blocks has anything
to do with that room. For example, POSIX doesn't specify the size of the
units that st_blocks uses, and it even allows the unit size to vary
depending on the file. One cannot really deduce much of anything from
st_blocks, if the goal is portability to any POSIX implementation.
I cannot see any reason why deduplication between different
filesystems that share a common dataset should be alllowed to be visible at
user level.
I can. Filesystem implementers are trying to shoehorn their modern
designs into the POSIX st_blocks interface which is loosely-specified
and was inspired by an antiquated design. At some point, it is
reasonable for them to give up with the pretense and just put 0 in
st_blocks, since whatever number is put in there is in some sense
"wrong" anyway.