]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cp: avoid speculative preallocation with --sparse=always
authorPádraig Brady <P@draigBrady.com>
Mon, 6 Oct 2014 09:19:58 +0000 (10:19 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 15 Oct 2014 01:19:37 +0000 (02:19 +0100)
commiteafa6ebf10924ec36cb5d28fd9d97a23de089bd0
tree3ee55b7ececa569a813bad821b24ce1f9918a3fa
parent759b0ac9e7f3fbd0f04090e3142087bf692e47bc
cp: avoid speculative preallocation with --sparse=always

With --sparse=always use fallocate(...PUNCH_HOLE...) to
avoid any permanent allocation due to speculative
preallocation employed by file systems such as XFS.

* m4/jm-macros.m4: Check for <linux/falloc.h> and fallocate().
* src/copy.c (punch_hole): A new function to try and punch
a hole at the specified offset if supported.
(create_hole): Call punch_hole() after requesting a hole.
(extent_copy): Likewise.
* NEWS: Mention the improvement.
NEWS
m4/jm-macros.m4
src/copy.c