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

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 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">1,</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8389em;vertical-align:-0.1944em;"></span><span class="mord">1</span><span class="mpunct">,</span></span></span></span>2}'>  ff1 || fail=1
 filefrag -v j2 | awk '/^ / {print <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">1,</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8389em;vertical-align:-0.1944em;"></span><span class="mord">1</span><span class="mpunct">,</span></span></span></span>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.]