-
Notifications
You must be signed in to change notification settings - Fork 6
Commit 7986758
committed
Use 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 3.04 times faster than main
access-log-no-subst copy-file-range is 1.54 times faster than main
access-log-subst copy-file-range is 1.04 times faster than main
access-log-no-del copy-file-range is 1.56 times faster than main
access-log-all-del copy-file-range is 1.02 times faster than main
access-log-translit copy-file-range is 1.03 times faster than main
access-log-complex-sub main is similarly fast as copy-file-range
access-log-append copy-file-range is 1.02 times faster than main
remove-cr copy-file-range is 1.02 times faster than main
genome-subst copy-file-range is 1.03 times faster than main
number-fix copy-file-range is 1.02 times faster than main
long-script main is similarly fast as copy-file-range
hanoi main is similarly fast as copy-file-range
factorial copy-file-range is 1.01 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..20479]: 11917296..11937775 20480 0x2000
1: [20480..20487]: 11937776..11937783 8 0x0
2: [20488..40959]: 11937784..11958255 20472 0x2000
3: [40960..40967]: 11958256..11958263 8 0x0
4: [40968..61439]: 11958264..11978735 20472 0x2000
5: [61440..61447]: 11978736..11978743 8 0x0
6: [61448..81919]: 11978744..11999215 20472 0x2000
7: [81920..81927]: 11999216..11999223 8 0x0
8: [81928..102399]: 11999224..12019695 20472 0x2000
9: [102400..102407]: 12019696..12019703 8 0x0
10: [102408..122879]: 12019704..12040175 20472 0x2000
11: [122880..122887]: 12040176..12040183 8 0x01 parent 9713cea commit 7986758Copy full SHA for 7986758
File tree
Expand file treeCollapse file tree
3 files changed
+452
-72
lines changedFilter options
- src/uu/sed/src
- tests
- by-util
- fixtures/sed/output
Expand file treeCollapse file tree
3 files changed
+452
-72
lines changed
0 commit comments