]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/copy.c
basic/copy: use copy_file_range()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 15 Mar 2016 23:26:34 +0000 (19:26 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 17 Mar 2016 17:02:18 +0000 (13:02 -0400)
commita44202e98b638024c45e50ad404c7069c7835c04
tree1b82ca988d199923f37315d2f935626abdb2a8a3
parent1d4b557d1b5cd200b27562808c690653658ffadf
basic/copy: use copy_file_range()

For btrfs, c_f_r() is like BTRFS_IOC_CLONE which we already used, but also
works when max_bytes is set. We do call copy_bytes in coredump code with
max_bytes set, and for large files, so we might see some benefit from using
c_f_r() on btrfs.

For other filesystems, c_f_r() falls back to do_splice_direct(), the same as
sendfile, which we already call, so there shouldn't be much difference.

Tested with test-copy and systemd-coredump on Linux 4.3 (w/o c_f_r)
and 4.5 (w/ c_f_r).
TODO
src/basic/copy.c