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

From: Jim Meyering <[email-masked]>
Date: Thu, 27 May 2010 20:45:24 +0200

jeff.liu wrote:
> Jim Meyering wrote:
>> jeff.liu wrote:
>>> This is the revised version, it fixed the fiemap-start offset calculation
>>> approach to remove it out
>>> of the 'for (i = 0; i < fiemap->fm_mapped_extents; i++)' loop.
>>
>> Hi Jeff,
>>
>> I've included below the state of my local changes.
>> Unfortunately, with that 5-patch series, there is always a test failure
>> on F13/ext4.  Maybe someone who knows more about extents can provide an
>> explanation?
>>
>> Here's a small example to demonstrate:
>>
>> Create a file with many extents:
>>
>>     perl -e 'BEGIN { $n = 19 * 1024; *F = *STDOUT }' \
>>       -e 'for (1..100) { sysseek (*F, $n, 1)' \
>>       -e '&& syswrite (*F, "."x$n) or die "$!"}' > j1
>>
>> Using the patched "cp", repeat the following 10 or 20 times:
>>
>>     ./cp --sparse=always j1 j2; sync
>>     filefrag -v j1 | awk '/^ / {print $1,$2}' > ff1 || fail=1
>>     filefrag -v j2 | awk '/^ / {print $1,$2}' > ff2 || fail=1
>>     diff -u ff1 ff2 || fail=1
>>
>> Usually there is no diff output, but occasionally it'll print this:
>> [hmm... today it consistently prints these differences every other time.]
> Woo!!!
> I just run this test on btrfs/ext4/ocfs2 against mainline kernel(Linux jeff-laptop
> 2.6.33-rc5-00238-gb04da8b-dirty) on my laptop.
> Only btrfs always works well for me, Ext4 has the same issue like yours.

One more point of reference:
the tests all passed on an XFS file system.