]> err.no Git - systemd/commitdiff
readahead-replay: use posix_fadvise instead of readahead
authorHarald Hoyer <harald@redhat.com>
Fri, 24 Sep 2010 10:54:05 +0000 (12:54 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 26 Sep 2010 13:53:23 +0000 (15:53 +0200)
src/readahead-replay.c

index a5a2936b3e816ce751ddb30d9160d36781af50bc..32941c144d5553dddcda4ca6dc7e88f04caf50b0 100644 (file)
@@ -89,8 +89,8 @@ static int unpack_file(FILE *pack) {
                 any = true;
 
                 if (fd >= 0)
-                        if (readahead(fd, b * PAGE_SIZE, (c - b) * PAGE_SIZE) < 0) {
-                                log_warning("readahead() failed: %m");
+                        if (posix_fadvise(fd, b * PAGE_SIZE, (c - b) * PAGE_SIZE, POSIX_FADV_WILLNEED) < 0) {
+                                log_warning("posix_fadvise() failed: %m");
                                 goto finish;
                         }
         }
@@ -100,8 +100,8 @@ static int unpack_file(FILE *pack) {
                  * intended to mean that the whole file shall be
                  * read */
 
-                if (readahead(fd, 0, st.st_size) < 0) {
-                        log_warning("readahead() failed: %m");
+                if (posix_fadvise(fd, 0, st.st_size, POSIX_FADV_WILLNEED) < 0) {
+                        log_warning("posix_fadvise() failed: %m");
                         goto finish;
                 }
         }