From 20ec1c2b42dbef01e4a996e9b450274518564bf3 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Tue, 10 Sep 2013 21:36:46 +0100 Subject: [PATCH] getdata: use correct file caching advice The POSIX_FADV_NOREUSE is more appropriate considering dhcpd-pools may need cache, but not necessarily. Reference: http://lwn.net/Articles/449420/ Signed-off-by: Sami Kerola --- src/getdata.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/getdata.c b/src/getdata.c index 8b411f4..b4a6763 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -73,12 +73,12 @@ int parse_leases(void) err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); } #ifdef HAVE_POSIX_FADVISE -# ifdef POSIX_FADV_WILLNEED - if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_WILLNEED) != 0) { +# ifdef POSIX_FADV_NOREUSE + if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_NOREUSE) != 0) { err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); } -# endif /* POSIX_FADV_WILLNEED */ +# endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { err(EXIT_FAILURE, "parse_leases: fadvise %s", @@ -215,11 +215,11 @@ void parse_config(int is_include, const char *restrict config_file, if (dhcpd_config == NULL) { err(EXIT_FAILURE, "parse_config: %s", config_file); } -#ifdef POSIX_FADV_WILLNEED - if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_WILLNEED) != 0) { +#ifdef POSIX_FADV_NOREUSE + if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) { err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); } -#endif /* POSIX_FADV_WILLNEED */ +#endif /* POSIX_FADV_NOREUSE */ #ifdef POSIX_FADV_SEQUENTIAL if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { err(EXIT_FAILURE, "parse_config: fadvise %s", config_file);