]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- improved fadvise usage 124/head
authorArvin Schnell <aschnell@suse.de>
Fri, 10 Oct 2014 10:16:09 +0000 (12:16 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 10 Oct 2014 10:16:09 +0000 (12:16 +0200)
package/snapper.changes
snapper/AppUtil.cc
snapper/Compare.cc

index cc04e1d09c168bbadeb1f746f5cba4a2f08765b9..e906c29e200c617162a3979976e414515e03bebd 100644 (file)
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Fri Oct 10 12:15:36 CEST 2014 - aschnell@suse.de
+
+- improved fadvise usage
+
 -------------------------------------------------------------------
 Fri Oct 3 01:05:01 CEST 2014 - dsterba@suse.cz
 
index f3804bf9ab41c06eac0b3c4f5e29a1fe4f163866..2db7269b51013aaf9b7e40f322946c8bc3467e68 100644 (file)
@@ -91,6 +91,11 @@ namespace snapper
     bool
     copyfile(int src_fd, int dest_fd)
     {
+       posix_fadvise(src_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
+
+       // TODO: maybe use POSIX_FADV_DONTNEED on dest_fd, but this could
+       // trigger a kernel bug (see bsc #888259)
+
        while (true)
        {
            // use small value for count to make function better interruptible
index 576845a640b9a3af7b9f0635ab9187ac07ec60df..50069a549603d46df2cd3c41109fff4d8614456d 100644 (file)
@@ -77,8 +77,8 @@ namespace snapper
            return false;
        }
 
-       posix_fadvise(fd1, 0, stat1.st_size, POSIX_FADV_SEQUENTIAL);
-       posix_fadvise(fd2, 0, stat2.st_size, POSIX_FADV_SEQUENTIAL);
+       posix_fadvise(fd1, 0, 0, POSIX_FADV_SEQUENTIAL);
+       posix_fadvise(fd2, 0, 0, POSIX_FADV_SEQUENTIAL);
 
        static_assert(sizeof(off_t) >= 8, "off_t is too small");