]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp: go back to copy_file_range optimization
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 22 Aug 2025 17:37:50 +0000 (10:37 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Aug 2025 00:40:29 +0000 (17:40 -0700)
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.

src/copy.c

index e328bd886f88c25bf6a4ace222807c3386dd6a99..134c57c8b7daabe1eed314cbcab580d6ad61fc87 100644 (file)
@@ -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;