Re: [PATCH] xfstests 255: add a seek_data/seek_hole tester

Dan Merillat
2011-08-31T04:48:17Z

On Tue, Aug 30, 2011 at 11:29 PM, Dave Chinner <david@fromorbit.com> wrote:
> On Tue, Aug 30, 2011 at 06:17:02PM -0700, Sunil Mushran wrote:
>> Instead
>> we should let the fs weigh the cost of providing accurate information
>> with the possible gain in performance.
>>
>> Data:
>> A range in a file that could contain something other than nulls.
>> If in doubt, it is data.
>>
>> Hole:
>> A range in a file that only contains nulls.
>
> And that's -exactly- the ambiguous, vague definition that has raised
> all these questions in the first place. I was in doubt about whether
> unwritten extents can be considered a hole, and by your definition
> that means it should be data. But Andreas seems to be in no doubt it
> should be considered a hole.

That's fine, though. Different filesystems have different abilities
to recognize a data hole - FAT can't do it at all. Perhaps the
requirements would be better stated in reverse: If the filesystem
knows that a read() will return nulls (for whatever reason based on
it's internal knowledge), it can report a hole. If it can't guarantee
that, it's data. It's an absolute requirement that SEEK_DATA never
miss data. SEEK_HOLE working is a nicety that userspace would
appreciate - remember that the consumer here is cp(1), using it to
skip empty portions of files and create sparse destination files.