readahead-replay: use posix_fadvise instead of readahead

This commit is contained in:
Harald Hoyer 2010-09-24 12:54:05 +02:00 committed by Lennart Poettering
parent efe5e8f7e1
commit 6e66797af4
1 changed files with 4 additions and 4 deletions

View 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;
}
}