diff --git a/NEWS b/NEWS index 7fb8c5363..0beaef506 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,12 @@ GNU coreutils NEWS -*- outline -*- ** Improvements + cp --sparse=auto (the default), mv, and install, + will use the copy_file_range syscall now also with sparse files. + This may be more efficient, by avoiding user space copies, + and possibly employing copy offloading or reflinking, + for the non sparse portion of such sparse files. + date --debug now diagnoses if multiple --date or --set options are specified, as only the last specified is significant in that case. 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;