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

From: Paul Eggert <[email-masked]>
Date: Fri, 16 Jul 2010 08:53:27 -0700

On 07/16/10 07:49, jeff.liu wrote:

> For now, I am inclined to separate efficient read through fiemap
> and improve the write and allocation stuff via fallocate() or other ways later.

I haven't had time to look at it carefully, but here's a very brief
review.  The code you sent, like what's in the fiemap branch, has
a separate version of a chunk of copy.c that does both reading
and writing and optimizes both reading and writing by invoking the fiemap ioctls
at strategic locations.  Instead, it would be better to have
a module that separates out the efficient-read stuff by telling
copy.c where the next significant input extent is, and then modify copy.c
to use that module.  On hosts that do not support fiemap, the module
would simply report the entire input file as that file's only extent.

Surely such an approach would be more modular, and would result in
less duplication of code.  I can write something along those lines
if there's interest and if nobody else wants to take a crack at it.