mirror of
https://https.git.savannah.gnu.org/git/coreutils.git
synced 2026-01-27 01:44:21 +00:00
copy: avoid posix_fadvise bypassing copy offload behavior
* src/copy-file-data.c (): pass 0 to posix_fadvise to indicate to EOF. coreutils 9.8 used OFF_T_MAX instead, which triggered OpenZFS 2.2.2 at least to synchronously (decompress and) populate the page cache. Addresses https://github.com/coreutils/coreutils/issues/122
This commit is contained in:
parent
58a66cf3fd
commit
231cc20195
@ -536,9 +536,12 @@ copy_file_data (int ifd, struct stat const *ist, off_t ipos, char const *iname,
|
||||
&& scantype != PLAIN_SCANTYPE)));
|
||||
|
||||
/* Don't bother calling fadvise for small copies, as it is not
|
||||
likely to help performance and might even hurt it. */
|
||||
likely to help performance and might even hurt it.
|
||||
Note it's important to use a 0 length to indicate the whole file
|
||||
as OpenZFS 2.2.2 at least will otherwise synchronously
|
||||
(decompress and) populate the cache when given a specific length. */
|
||||
if (IO_BUFSIZE < ibytes)
|
||||
fdadvise (ifd, ipos, ibytes <= OFF_T_MAX - ipos ? ibytes : 0,
|
||||
fdadvise (ifd, ipos, ibytes < OFF_T_MAX - ipos ? ibytes : 0,
|
||||
FADVISE_SEQUENTIAL);
|
||||
|
||||
/* If not making a sparse file, try to use a more-efficient
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user