2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

Indicate to the kernel that we won't be needing the zone dumps

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.
This commit is contained in:
Ondřej Surý 2021-05-27 11:04:37 +02:00
parent 8a5c62de83
commit e83b6569da

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