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

From: Joel Becker <[email-masked]>
Date: Wed, 16 Jun 2010 02:02:26 -0700

On Wed, Jun 16, 2010 at 10:49:08AM +0200, Jim Meyering wrote:
> > I would suggest not to add options like this,
> > and only do what's possible without new options
> > as it would push too many implementation details
> > to the docs/users IMHO.
> 
> Currently on the fiemap-copy branch, once we get a single
> successful ioctl, the code will not bother with the usual
> hole-detecting/introducing technique implied by --sparse=always.
> 
> Should it do that ever?  Always?
> Does this need an option?

	There should be no new or modified options.
	I think the code should, at all times and in all modes, attempt
to get an fiemap of the source file.  If cp is in --sparse=never mode,
it can use the mapping to plan its source file reads.  If it is in
--sparse=auto, it can always skip holes and unwritten extents, while
using the original --sparse=auto code to determine whether to scan
allocated extents for zeros.
	With this map, cp will never read holes or unwritten extents;
--sparse=never mode can write out the zeros without reading them.
	Calling the ioctl will never hurt the cp operation.  If the
ioctl fails, cp can use all of its original heuristics and copy code.

Joel

-- 

"Copy from one, it's plagiarism; copy from two, it's research."
        - Wilson Mizner

Joel Becker
Principal Software Developer
Oracle
E-mail: [email-masked]
Phone: (650) 506-8127