From: Michael Tremer Date: Mon, 5 Sep 2022 16:24:49 +0000 (+0000) Subject: archive: Tell the kernel that we will read the file sequentially X-Git-Tag: 0.9.28~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8e1aacb13d1399760be2949c63ff81a2403e822;p=pakfire.git archive: Tell the kernel that we will read the file sequentially Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/archive.c b/src/libpakfire/archive.c index a48cbbc21..62499943b 100644 --- a/src/libpakfire/archive.c +++ b/src/libpakfire/archive.c @@ -19,6 +19,7 @@ #############################################################################*/ #include +#include #include #include #include @@ -608,6 +609,13 @@ static int pakfire_archive_try_open(struct pakfire_archive* archive, const char* if (!archive->f) return 1; + // Let the kernel know, that we will read the file sequentially + r = posix_fadvise(fileno(archive->f), 0, 0, POSIX_FADV_SEQUENTIAL); + if (r) { + ERROR(archive->pakfire, "posix_fadvise() failed: %m\n"); + goto ERROR; + } + // Call stat() on f r = fstat(fileno(archive->f), &archive->stat); if (r) {