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

From: Dan Merillat
Date: Wed Aug 31 2011 - 00:48:23 EST


On Tue, Aug 30, 2011 at 11:29 PM, Dave Chinner <david@xxxxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/