* Pádraig Brady ([email protected]) [20120511 17:46]:
> This feature is already under consideration.
> See the comments at: http://bugs.gnu.org/9500
FWIW, SUSE patches coreutils (patch attached) to use fallocate when
sparse=never or non-sparse files with sparse=auto (!make_holes in
copy.c(copy_reg). But as Eric wrote in the above thread, it would need a
gnulib module for a correct implementation.
BTW, biggest win is for ocfs2 as it must take cluster wide locks on
fragmentation, which was the reason we added the patch.
Philipp
--- src/copy.c
+++ src/copy.c
@@ -1044,6 +1044,8 @@ copy_reg (char const *src_name, char const *dst_name,
buf_size -= buf_size % blcm;
if (buf_size == 0 || blcm_max < buf_size)
buf_size = blcm;
+
+ fallocate(dest_desc, FALLOC_FL_KEEP_SIZE, 0, src_sb->st_size);
}
/* Make a buffer with space for a sentinel at the end. */