From: Paul Eggert Date: Fri, 22 Aug 2025 17:37:50 +0000 (-0700) Subject: cp: go back to copy_file_range optimization X-Git-Tag: v9.8~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=306de6c2619e2a9339ade9a88d55c4940942d516;p=thirdparty%2Fcoreutils.git cp: go back to copy_file_range optimization This reverts part of the previous change. * src/copy.c (lseek_copy): When calling sparse_copy, do not ask it to scan for zeros unless --sparse=always, so that it can use copy_file_range which can be far more efficient. --- diff --git a/src/copy.c b/src/copy.c index e328bd886f..134c57c8b7 100644 --- a/src/copy.c +++ b/src/copy.c @@ -617,7 +617,7 @@ lseek_copy (int src_fd, int dest_fd, char **abuf, size_t buf_size, if ( ! sparse_copy (src_fd, dest_fd, abuf, buf_size, allow_reflink, src_name, dst_name, ext_len, - sparse_mode != SPARSE_NEVER ? hole_size : nullptr, + sparse_mode == SPARSE_ALWAYS ? hole_size : nullptr, &n_read)) return false;