From 330a6a769b2f104a420b1713a4b5b2e931308104 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sat, 20 Jul 2013 18:41:39 -0700 Subject: [PATCH] wbthrottle: use posix_fadvise if available Only adding information about data usage. This won't effect correctness. Signed-off-by: Noah Watkins --- configure.ac | 1 + src/os/WBThrottle.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 66d8f2161c99..86a5eee45f6c 100644 --- a/configure.ac +++ b/configure.ac @@ -539,6 +539,7 @@ AC_CHECK_FUNC([fallocate], AC_CHECK_HEADERS([sys/prctl.h]) AC_CHECK_FUNCS([prctl]) AC_CHECK_FUNCS([pipe2]) +AC_CHECK_FUNCS([posix_fadvise]) # Checks for typedefs, structures, and compiler characteristics. #AC_HEADER_STDBOOL diff --git a/src/os/WBThrottle.cc b/src/os/WBThrottle.cc index e02c17677bbd..9430c4fd3cde 100644 --- a/src/os/WBThrottle.cc +++ b/src/os/WBThrottle.cc @@ -1,6 +1,8 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab +#include "acconfig.h" + #include "os/WBThrottle.h" #include "common/perf_counters.h" @@ -146,8 +148,10 @@ void *WBThrottle::entry() clearing = wb.get<0>(); lock.Unlock(); ::fdatasync(**wb.get<1>()); +#ifdef HAVE_POSIX_FADVISE if (wb.get<2>().nocache) posix_fadvise(**wb.get<1>(), 0, 0, POSIX_FADV_DONTNEED); +#endif lock.Lock(); clearing = ghobject_t(); cur_ios -= wb.get<2>().ios; -- 2.47.3