On 04/21/2011 03:12 PM, Markus Trippelsdorf wrote:
> On 2011.04.21 at 22:09 +0200, Jim Meyering wrote:
>> Considering the potential for data loss when using coreutils-8.11 on
>> ext4 and xfs when using e.g., 2.6.39-rc3[*], here's a snapshot that will
>> soon become coreutils-8.12. Please give it a try.
>
> Looks good. The "files full of zeros" problem is gone and all 367 tests
> pass.
>
> The first (tiny) steps for SEEK_HOLE and SEEK_DATA support were just
> posted: http://thread.gmane.org/gmane.linux.kernel/1129696
Thanks for that pointer.
Here's hoping that the kernel implements the same documented semantics
as Solaris:
SEEK_HOLE - returns the offset of the next hole without repositioning
the file (all files have a virtual hole after the last data byte, so the
only time this fails is with ENXIO if you seek relative to an offset
beyond the end of the file).
SEEK_DATA - move the pointer to the start of the next non-hole, or fail
with ENXIO if there are no data sections after the requested position.
Typical usage would then be a loop of:
lseek(SEEK_HOLE) to learn where the next hole starts, and process all
bytes from current position to that point
lseek(SEEK_DATA) to skip past the hole that you just arrived at, where
ENXIO tells you you reached the end of the file.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc Description: OpenPGP digital signature