This patchset adds support for Linux copy_file_range() syscall usage via a new '--reflink' copy-out parameter. The syscall can considerably improve archive creation performance and space efficiency on copy-on-write filesystems such as XFS and Btrfs by performing a metadata only reflink instead of regular read/write copy I/O. The patchset is built on Luis' previous submission at: https://lists.gnu.org/archive/html/bug-cpio/2020-07/msg00001.html
An additional '--chain' parameter is also added for appending a new archive to an existing file. This is useful for Linux initramfs images, which can be chained back-to-back. Unit test coverage for both new parameters is provided. Dracut changes to make use of the above features when building a Linux initramfs image have been submitted upstream via: https://github.com/dracutdevs/dracut/pull/1148 . This patch set also carries the queued change at https://savannah.gnu.org/patch/?9263 . Feedback appreciated. Changes since v1 (thanks Luis): - add copy_files_range caller -ENODATA fallback - add test coverage for sparse files with --reflink + I decided against adding back SEEK_DATA / SEEK_HOLE functionality to the copy_files_range loop, as seek cursor tracking and error handling add significant complexity with little benefit to my initramfs generation workload - I'll send through the RFC patch I have for the curious Cheers, David -- configure.ac | 6 +++ src/copyin.c | 2 +- src/copyout.c | 43 ++++++++++++++--- src/extern.h | 7 ++- src/global.c | 7 ++- src/main.c | 50 ++++++++++++++++++-- src/mt.c | 4 +- src/util.c | 65 ++++++++++++++++++++++++-- tests/chain.at | 91 ++++++++++++++++++++++++++++++++++++ tests/reflink-sparse.at | 67 +++++++++++++++++++++++++++ tests/reflink.at | 100 ++++++++++++++++++++++++++++++++++++++++ tests/testsuite.at | 3 ++ 12 files changed, 426 insertions(+), 19 deletions(-)
