On Sat, Aug 31, 2019 at 01:45:57AM +0100, David Howells wrote: > Christoph Hellwig <hch@xxxxxx> wrote: > > > We'll you'd need to implement a IOCB_NOHOLE, but that wouldn't be all > > that hard. Having a READ_PLUS like interface that actually tells you > > how large the hole is might be hard. > > Actually, that raises another couple of questions: > > (1) Is a filesystem allowed to join up two disjoint blocks of data with a > block of zeros to make a single extent? If this happens, I'll see the > inserted block of zeros to be valid data. Yes. > (2) Is a filesystem allowed to punch out a block of valid zero data to make a > hole? This would cause me to refetch the data. Yes. Essentially, assumptions that filesystems will not change the file layout even if the data does not change are invalid. copy-on-write, deduplication, speculative preallocation, etc mean the file layout can change even if the file data itself is not directly modified. If you want to cache physical file layout information and be notified when they may change, then that's what layout leases are for.... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx