I was debugging a change in coreutils 9.8 and noticed that fadvise was
being passed OFF_T_MAX to indicate to apply advice to end of file.

This struck me as a bit unusual and coreutils <= 9.7 used 0 to do the same 
thing.
It seems to me like 0 may be treated specially or more efficiently in more 
cases?

How about the following to go back to 0 meaning, to end of file?

cheers,
Padraig

diff --git a/src/copy-file-data.c b/src/copy-file-data.c
index 1eefd3071..c3abe41e2 100644
--- a/src/copy-file-data.c
+++ b/src/copy-file-data.c
@@ -538,7 +538,7 @@ copy_file_data (int ifd, struct stat const *ist, off_t 
ipos, char const *iname,
   /* Don't bother calling fadvise for small copies, as it is not
      likely to help performance and might even hurt it.  */
   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

Reply via email to