]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp,mv,install: provide POSIX_FADV_SEQUENTIAL hint to input
authorPádraig Brady <P@draigBrady.com>
Tue, 1 May 2012 20:50:49 +0000 (21:50 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 2 May 2012 17:41:53 +0000 (18:41 +0100)
This was inadvertently omitted from v8.5-104-g47076e3,
and gives the same 5% speedup when copying from an SSD.

* src/copy.c (copy_internal): Apply the FADVISE_SEQUENTIAL hint.

src/copy.c

index 26bbcf22eae5a1491bb3d6bd37d2ce1eb9adef5c..844ebcd78a0c6bcea892cf863a2afc9d05ac024e 100644 (file)
@@ -39,6 +39,7 @@
 #include "cp-hash.h"
 #include "extent-scan.h"
 #include "error.h"
+#include "fadvise.h"
 #include "fcntl--.h"
 #include "fiemap.h"
 #include "file-set.h"
@@ -980,6 +981,8 @@ copy_reg (char const *src_name, char const *dst_name,
       size_t buf_alignment_slop = sizeof (word) + buf_alignment - 1;
       size_t buf_size = io_blksize (sb);
 
+      fdadvise (source_desc, 0, 0, FADVISE_SEQUENTIAL);
+
       /* Deal with sparse files.  */
       bool make_holes = false;
       bool sparse_src = false;