Skip to content

Commit b9f4634

Browse files
committed
Improve performance with copy_file_range(2)
On file systems supporting reflinks or extent remapping, such as XFS, Btrfs, NFS, regions of files that are not modified are processed without any copying — with O(1) cost. While at it: - Correct the use of write(2) to handle partial writes and report appropriate errors. - Improve buffer sizing. These are the benchmark results no-op-short copy-file-range is 1.17 times faster than main access-log-no-op copy-file-range is 2.91 times faster than main access-log-no-subst copy-file-range is 1.56 times faster than main access-log-subst copy-file-range is 1.03 times faster than main access-log-no-del copy-file-range is 1.59 times faster than main access-log-all-del copy-file-range is 1.06 times faster than main access-log-translit copy-file-range is 1.05 times faster than main access-log-complex-sub copy-file-range is 1.04 times faster than main access-log-append copy-file-range is 1.05 times faster than main remove-cr copy-file-range is 1.03 times faster than main genome-subst copy-file-range is 1.08 times faster than main number-fix copy-file-range is 1.03 times faster than main long-script main is similarly fast as copy-file-range hanoi main is 1.03 times faster than copy-file-range factorial copy-file-range is 1.03 times faster than main On suported file systems (XFS, BTRFS), output files with no or few in-place modifications share large blocks with the input file, as can be seen in the following example. $ xfs_io -c 'fiemap -v' lines.txt lines.txt: EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS 0: [0..857199]: 11917304..12774503 857200 0x2000 1: [857200..857207]: 12774504..12774511 8 0x1
1 parent 9713cea commit b9f4634

File tree

3 files changed

+796
-104
lines changed

3 files changed

+796
-104
lines changed

0 commit comments

Comments
 (0)