Subject: bug#6131: [PATCH]: fiemap support for efficient sparse file copy

From: Tao Ma <[email-masked]>
Date: Wed, 16 Jun 2010 21:58:02 +0800

On 06/16/2010 05:03 PM, Joel Becker wrote:
> On Wed, Jun 16, 2010 at 02:57:01PM +0800, jeff.liu wrote:
>> Paul Eggert wrote:
>>> For example, if a fiemap_extent has the FIEMAP_EXTENT_UNWRITTEN flag
>>> set, cp should treat that as a hole, because the extent is all zeros.
>>> (This will greatly help performance in some cases.)  Also, if an input
>>> extent is read and a block of it is found to be zeros, cp should skip
>>> over that block when writing.
>> If FIEMAP_EXTENT_UNWRITTEN flag is set, we can call fallocate(2) against the dest file directly for
>> the performance boost.
>
> 	Nope.  An UNWRITTEN extent is a hole, and the user asked for
> holes.  If cp sees an UNWRITTEN extent it is skipped.
yeah, I agree with this.
The unwritten extent is allocated by the user for the source file. Since 
there is no user say to us that the target also need extra allocation, 
we'd better just leave a hole there. ;)

Regards,
Tao