seeking advice on sparse files on xfs

Joe Landman joe.landman at gmail.com
Wed Dec 19 16:17:45 CST 2012


Hi folks:

   I've been using sparse files on xfs for a while, and every now and 
then have the pleasure of copying them.  Using coreutils cp (standard 
linux cp) usually winds up with the utility seeking through the entire 
file (yes, even with with the --sparse=* options set).

   It seems to me that the code is blissfully unware of the file 
extents, and its sparse implementation amounts to a read, a check to see 
if it needs to write it as a hole, write it, and the next seek.  Iterate 
until done.

   Here's my question.  Is there a way to (easily) programmatically hand 
cp (or any other utility) something akin to the output of xfs_bmap, and 
thus save it potentially *gargantuan* amounts of seeking over known zero 
regions?  File sparsity in these cases are from 80-99% in some cases 
(fills of 1-20%) for multi GB/TB sized files.

   Pointers appreciated.  I am looking at the copy routines in coreutils 
now, looking to see if we can increase its intelligence somewhat w.r.t. 
sparse files.

   Thanks!

Joe



More information about the xfs mailing list