Eric Sandeen wrote:
...
> The testcase in coreutils should definitely remove the fdatasync
> hack, as that just makes the test pass without worrying about things
> in the real world. :) A better test suite might be to generate
> random holey / delalloc files and copy those around.
>
> We should write an xfstests test to do the same thing, if we can
> determine whether we have a "cp" that knows about fiemap?
On ext4, FIEMAP-enabled cp will preserve the hole in this file,
but older versions will not:
perl -e 'sysseek (*STDOUT, 4096, 1) && print "a" or die "$!"' > j
cp j k; test $(stat --format %b j) = $(stat --format %b k) \
|| { du -sh j k; echo FAIL; }
With cp from coreutils-8.10, both k and j occupy 8 blocks on ext4.
Using F14's /bin/cp (coreutils-8.5+), k occupies 16 blocks.