Performance optimization in av::fixup - use buffered IO, not mapped file

Eric Blake
Wed Dec 12 15:17:00 GMT 2012

On 12/12/2012 07:31 AM, Corinna Vinschen wrote:
> On Dec 12 07:04, Eric Blake wrote:
>> On 12/12/2012 06:22 AM, Corinna Vinschen wrote:
>>> On Dec 12 06:11, Eric Blake wrote:
>>>> Eww.  That would be a regression for coreutils, [...]
>>> Really?  How so?
>> When using 'cp --sparse=always', coreutils relies on lseek() to create
>> sparse files.  Removing this code from cygwin would mean that coreutils
>> now has to be rewritten to explicitly ftruncate() instead of lseek() for
>> creating sparse files.
> On Cygwin only or on Linux as well?

On cygwin only.

>> of using ftruncate() when plain lseek() would do to keep them sparse.
> Couldn't Devil's advocate also argue that coreutils are wrong?

If ftruncate() is the only way on cygwin to make a sparse file, I
suppose coreutils could adapt.

>> Oh, and while I'm thinking about it, it would be nice to copy Linux'
>> fallocate(FALLOC_FL_PUNCH_HOLE) for punching holes into already-existing
>> files, rather than only being able to create holes by sequentially
>> building a file with each new hole possible only as the file size is
>> extended.
> Hmm, that might be possible by utilising the FSCTL_SET_SPARSE and
> FSCTL_SET_ZERO_DATA DeviceIoControl codes.  However, we don't export
> fallocate at all right now.  This is a clear case of PHC(*)
> Corinna
> (*) Patches happily considered.

Yep, I thought as much on this one :)

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Cygwin-developers mailing list