From 43c386b72ee834c88a1a22500ce1fc36a8208277 Mon Sep 17 00:00:00 2001 From: James Golick Date: Tue, 10 Dec 2013 22:34:19 -0800 Subject: [PATCH 1/2] only try to use fallocate if it's actually present on the system --- build_tools/build_detect_platform | 12 ++++++++++++ util/env_posix.cc | 8 ++++---- util/posix_logger.h | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 59e2e4619..96a1fb331 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -189,6 +189,18 @@ EOF COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_ATOMIC_PRESENT" fi + # Test whether fallocate is available + $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null < + int main() { + int fd = open("/dev/null", 0); + fallocate(fd, 0, 0, 1024); + } +EOF + if [ "$?" = 0 ]; then + COMMON_FLAGS="$PLATFORM_LDFLAGS -DROCKSDB_FALLOCATE_PRESENT" + fi + # Test whether Snappy library is installed # http://code.google.com/p/snappy/ $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null < Date: Wed, 11 Dec 2013 11:18:00 -0800 Subject: [PATCH 2/2] oops - missed a spot --- util/env_posix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index e81c59dcc..2be524e95 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -1297,7 +1297,7 @@ class PosixEnv : public Env { } bool SupportsFastAllocate(const std::string& path) { -#ifdef OS_LINUX +#ifdef ROCKSDB_FALLOCATE_PRESENT struct statfs s; if (statfs(path.c_str(), &s)){ return false;