From 20c44fefb709043fdd2d12f892cd2d0544702700 Mon Sep 17 00:00:00 2001 From: Amit Arya Date: Wed, 2 Sep 2015 11:17:02 -0700 Subject: [PATCH] t6913679: Use fallocate on LOG FILESS Summary: Use fallocate on LOG FILES to Test Plan: make check + ===check with strace=== [arya@devvm1441 ~/rocksdb] strace -e trace=fallocate ./ldb --db=/tmp/test_new scan fallocate(3, 01, 0, 4194304) = 0 Reviewers: sdong, anthony, IslamAbdelRahman, kradhakrishnan, lgalanis, rven, igor Reviewed By: igor Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D45969 --- util/env_posix.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/env_posix.cc b/util/env_posix.cc index ccaed9b04c..af2ab8e5de 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -1134,6 +1134,9 @@ class PosixEnv : public Env { return IOError(fname, errno); } else { int fd = fileno(f); +#ifdef ROCKSDB_FALLOCATE_PRESENT + fallocate(fd, FALLOC_FL_KEEP_SIZE, 0, 4 * 1024 * 1024); +#endif SetFD_CLOEXEC(fd, nullptr); result->reset(new PosixLogger(f, &PosixEnv::gettid, this)); return Status::OK();