From 10488b0a040d2702273a7922c8b6bcebfb3cd85f Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 22 Jan 2011 22:05:53 +0100 Subject: [PATCH] posix_fadvice advice parameter change With a bit of manual rereading and thinking I came to conclusion that users will most likely fetch same data over and over again. Advicing to kernel to keep pages into cache seems to be correct thing to do. Signed-off-by: Sami Kerola --- src/getdata.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/getdata.c b/src/getdata.c index b1e79b9..1a7cba8 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -76,16 +76,16 @@ int parse_leases(void) err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); } -#ifdef POSIX_FADV_NOREUSE - posix_fadvise((long) dhcpd_leases, 0, 0, POSIX_FADV_NOREUSE); +#ifdef POSIX_FADV_WILLNEED + posix_fadvise((long) dhcpd_leases, 0, 0, POSIX_FADV_WILLNEED); if (errno) { - err(EXIT_FAILURE, "parse_leases: fadvise noreuse"); + err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); } -#endif /* POSIX_FADV_NOREUSE */ +#endif /* POSIX_FADV_WILLNEED */ #ifdef POSIX_FADV_SEQUENTIAL posix_fadvise((long) dhcpd_leases, 0, 0, POSIX_FADV_SEQUENTIAL); if (errno) { - err(EXIT_FAILURE, "parse_leases: fadvise sequential"); + err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); } #endif /* POSIX_FADV_SEQUENTIAL */ @@ -228,16 +228,16 @@ char *parse_config(int is_include, char *config_file, if (dhcpd_config == NULL) { err(EXIT_FAILURE, "parse_config: %s", config_file); } -#ifdef POSIX_FADV_NOREUSE - posix_fadvise((long) dhcpd_config, 0, 0, POSIX_FADV_NOREUSE); +#ifdef POSIX_FADV_WILLNEED + posix_fadvise((long) dhcpd_config, 0, 0, POSIX_FADV_WILLNEED); if (errno) { - err(EXIT_FAILURE, "parse_config: fadvise noreuse"); + err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); } -#endif /* POSIX_FADV_NOREUSE */ +#endif /* POSIX_FADV_WILLNEED */ #ifdef POSIX_FADV_SEQUENTIAL posix_fadvise((long) dhcpd_config, 0, 0, POSIX_FADV_SEQUENTIAL); if (errno) { - err(EXIT_FAILURE, "parse_config: fadvise sequential"); + err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); } #endif /* POSIX_FADV_SEQUENTIAL */ -- 1.7.10.4