From: Tobias Oetiker Date: Mon, 20 Oct 2014 13:12:57 +0000 (+0200) Subject: do not call fadvise when working mmapped X-Git-Tag: v1.5.0-rc1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8252da5b4ad33201ce89f42961cca64111398640;p=thirdparty%2Frrdtool-1.x.git do not call fadvise when working mmapped --- diff --git a/src/rrd_open.c b/src/rrd_open.c index e7b781c0..6838b99c 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -540,15 +540,16 @@ void rrd_dontneed( + rrd->rra_ptr[i].cur_row * rrd->stat_head->ds_cnt * sizeof(rrd_value_t)); if (active_block > dontneed_start) { -#ifdef USE_MADVISE +#ifdef USE_MADVISE madvise(rrd_simple_file->file_start + dontneed_start, active_block - dontneed_start - 1, MADV_DONTNEED); -#endif -/* in linux at least only fadvise DONTNEED seems to purge pages from cache */ +#else #ifdef HAVE_POSIX_FADVISE +/* in linux at least only fadvise DONTNEED seems to purge pages from cache */ posix_fadvise(rrd_simple_file->fd, dontneed_start, active_block - dontneed_start - 1, POSIX_FADV_DONTNEED); +#endif #endif } dontneed_start = active_block; @@ -568,11 +569,12 @@ void rrd_dontneed( #ifdef USE_MADVISE madvise(rrd_simple_file->file_start + dontneed_start, rrd_file->file_len - dontneed_start, MADV_DONTNEED); -#endif +#else #ifdef HAVE_POSIX_FADVISE posix_fadvise(rrd_simple_file->fd, dontneed_start, rrd_file->file_len - dontneed_start, POSIX_FADV_DONTNEED); +#endif #endif }