]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Indicate to the kernel that we won't be needing the zone dumps
authorOndřej Surý <ondrej@sury.org>
Thu, 27 May 2021 09:04:37 +0000 (11:04 +0200)
committerOndřej Surý <ondrej@sury.org>
Mon, 31 May 2021 12:52:05 +0000 (14:52 +0200)
Add a call to posix_fadvise() to indicate to the kernel, that `named`
won't be needing the dumped zone files any time soon with:

 * POSIX_FADV_DONTNEED - The specified data will not be accessed in the
   near future.

Notes:

 POSIX_FADV_DONTNEED attempts to free cached pages associated with the
 specified region. This is useful, for example, while streaming large
 files. A program may periodically request the kernel to free cached
 data that has already been used, so that more useful cached pages are
 not discarded instead.

lib/dns/masterdump.c

index 0c8a400196ed56dd8aa4a9d08596dfa33f86ac43..c5f00bd1c3301edee3d4aaeeb09ec59eed90d9f7 100644 (file)
@@ -1898,6 +1898,11 @@ opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
                              isc_result_totext(result));
                goto cleanup;
        }
+
+#if defined(POSIX_FADV_DONTNEED)
+       posix_fadvise(fileno(f), 0, 0, POSIX_FADV_DONTNEED);
+#endif
+
        *tempp = tempname;
        *fp = f;
        return (ISC_R_SUCCESS);