GNU bug report logs - #9500
cp: use posix_fallocate where supported

Previous Next

Package: coreutils;

Reported by: Kelly Anderson <kelly <at> silka.with-linux.com>

Date: Wed, 14 Sep 2011 06:47:02 UTC

Severity: wishlist

Tags: patch

Full log


Message #35 received at 9500 <at> debbugs.gnu.org (full text, mbox):

From: Goswin von Brederlow <goswin-v-b <at> web.de>
To: Padraig Brady <P <at> draigBrady.com>
Cc: 9500 <at> debbugs.gnu.org, Kelly Anderson <kelly <at> silka.with-linux.com>,
	Goswin von Brederlow <goswin-v-b <at> web.de>
Subject: Re: bug#9500: [PATCH]: use posix_fallocate where supported
Date: Sat, 26 Nov 2011 04:55:08 +0100
Pádraig Brady <P <at> draigBrady.com> writes:

> On 11/25/2011 10:13 AM, Pádraig Brady wrote:
>
>> Hmm, one of your points above got me thinking.
>> Might fallocate() fail to allocate an extent with ENOSPC,
>> but there could be fragmented space available to write()?
>> That would scupper benefit (2) above :(
>> I'll ask linux-fsdevel <at> vger.kernel.org
>
> And the response from there is that fallocate() will
> check the free blocks first, and then try to allocate
> as a contiguous extent, but that part is not guaranteed.
> So we still get benefit (2).
>
> cheers,
> Pádraig.

Don't forget that a sparse file uses less space than its size. So any cp
mode that checks for zero filled blocks and omits them on the
destination might use less blocks than the source uses or than the
fiemap indicates.

So cp can only fail on ENOSPC from fallocate() if it does not skip zero
filled blocks. I.e. when --sparse=never or --sparse=auto doesn't detect
a sparse file. But that is quite often the case.

MfG
        Goswin




This bug report was last modified 6 years and 293 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.