summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2022-12-30 19:34:27 +0000
committerPádraig Brady <P@draigBrady.com>2022-12-31 00:20:45 +0000
commit879d2180d6b58e7a83312681fbce9a1e841c2ae4 (patch)
tree05e1f38b37df59083fa494810966cd246cf1b699 /src
parent266b7cbc846f91e5f48085c7de68682f5841e2a0 (diff)
downloadcoreutils-879d2180d6b58e7a83312681fbce9a1e841c2ae4.tar.gz
copy: attempt copy offload with sparse files by default
This was seen to vastly improve performance on NFS 4.2 systems by allowing server side copies, with partially sparse files (avidemux generated mp4 files). * src/copy.c (lseek_copy): Also set hole_size to 0, i.e. enable copy_file_range(), with --sparse=auto (the default), to enable copy offload in this case, as we've strong signal from SEEK_DATA that we're operating on actual data and not holes here. * NEWS: Mention the improvement. Fixes https://bugs.gnu.org/60416
Diffstat (limited to 'src')
-rw-r--r--src/copy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c
index e465271ef..7407517f1 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -526,12 +526,12 @@ lseek_copy (int src_fd, int dest_fd, char **abuf, size_t buf_size,
last_ext_len = ext_len;
/* Copy this extent, looking for further opportunities to not
- bother to write zeros unless --sparse=never, since SEEK_HOLE
+ bother to write zeros if --sparse=always, since SEEK_HOLE
is conservative and may miss some holes. */
off_t n_read;
bool read_hole;
if ( ! sparse_copy (src_fd, dest_fd, abuf, buf_size,
- sparse_mode == SPARSE_NEVER ? 0 : hole_size,
+ sparse_mode != SPARSE_ALWAYS ? 0 : hole_size,
true, allow_reflink, src_name, dst_name,
ext_len, &n_read, &read_hole))
return false;