bug#6131: [PATCH]: fiemap support for efficient sparse file copy (original) (raw)

[Top][All Lists]


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Jim Meyering
Subject: bug#6131: [PATCH]: fiemap support for efficient sparse file copy
Date: Fri, 11 Jun 2010 14:38:08 +0200

jeff.liu wrote:

Sunil Mushran wrote: ... > I guess we'll have to use FIEMAPFLAGSYNC. Hi Sunil,

Thanks for the comments. So we can ensure the source file synced before mapping in this way.

Hi Jim and Paul,

How about the tiny patch below? ... Subject: [PATCH 1/1] copy.c: add FIEMAPFLAGSYNC to fiemap ioctl

* src/copy.c (fiemapcopy): Force kernel to sync the source file before mapping.

Signed-off-by: Jie Liu <address@hidden> --- src/copy.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/copy.c b/src/copy.c index f149be4..f48c74d 100644 --- a/src/copy.c +++ b/src/copy.c @@ -191,6 +191,7 @@ fiemapcopy (int srcfd, int destfd, sizet bufsize, do { fiemap->fmlength = FIEMAPMAXOFFSET; + fiemap->fmflags = FIEMAPFLAGSYNC; fiemap->fmextentcount = count;

Thanks to both of you. That patch looks fine, Jeff. However, at least with ext4 and fedora 13, I require this change to pass "make check". Note the new entry in the "flags" column:

==> ff2 <==
Filesystem type is: ef53
File size of j2 is 2048 (1 block, blocksize 4096)
 ext logical physical expected length flags
   0       0        0               1 unknown,delalloc,eof
j2: 1 extent found

So I will apply the test-fixing patch first, then your change, Jeff, and then rebase to the latest on master.

From 484903dc41246cb3c774f178f695725561b105a0 Mon Sep 17 00:00:00 2001 From: Jim Meyering <address@hidden> Date: Fri, 11 Jun 2010 14:34:03 +0200 Subject: [PATCH 1/2] tests: accommodate varying filefrag -v "flags" output


tests/cp/sparse-fiemap | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap index dc0cf60..b6b1103 100755 --- a/tests/cp/sparse-fiemap +++ b/tests/cp/sparse-fiemap @@ -68,10 +68,11 @@ $PERL -e 1 || skip_test_ 'skipping part of this test; you lack perl'

Extract logical block number and length pairs from filefrag -v output.

The initial sed is to remove the "eof" from the normally-empty "flags" field.

+# Similarly, remove flags values like "unknown,delalloc,eof".

That is required when that final extent has no number in the "expected"

field. f() {

-- 1.7.1.501.g23b46