Add flag to forcibly disable fallocate
Summary: see https://github.com/facebook/rocksdb/issues/977; there are issues with fallocate() on certain filesystems/kernel versions that can lead it to pre- allocating blocks but never freeing them, even if they're unused. Test Plan: verified build commands omit DROCKSDB_FALLOCATE_PRESENT when this env variable is set. without disabling it: $ ROCKSDB_NO_FBCODE=1 make -n env_test | grep -q DROCKSDB_FALLOCATE_PRESENT ; echo $? 0 with disabling it: $ ROCKSDB_NO_FBCODE=1 DISABLE_FALLOCATE=1 make -n env_test | grep -q DROCKSDB_FALLOCATE_PRESENT ; echo $? 1 Reviewers: kradhakrishnan, yhchiang, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D54069
This commit is contained in:
parent
92a9ccf1a6
commit
6a2b4fcb80
@ -189,17 +189,19 @@ if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then
|
|||||||
# Also don't need any compilation tests if compiling on fbcode
|
# Also don't need any compilation tests if compiling on fbcode
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
# Test whether fallocate is available
|
if ! test $ROCKSDB_DISABLE_FALLOCATE; then
|
||||||
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
|
# Test whether fallocate is available
|
||||||
#include <fcntl.h>
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
|
||||||
#include <linux/falloc.h>
|
#include <fcntl.h>
|
||||||
int main() {
|
#include <linux/falloc.h>
|
||||||
int fd = open("/dev/null", 0);
|
int main() {
|
||||||
fallocate(fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 0, 1024);
|
int fd = open("/dev/null", 0);
|
||||||
}
|
fallocate(fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 0, 1024);
|
||||||
|
}
|
||||||
EOF
|
EOF
|
||||||
if [ "$?" = 0 ]; then
|
if [ "$?" = 0 ]; then
|
||||||
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_FALLOCATE_PRESENT"
|
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_FALLOCATE_PRESENT"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test whether Snappy library is installed
|
# Test whether Snappy library is installed
|
||||||
|
Loading…
Reference in New Issue
Block a user