remove warning
Summary: st_blocks shows 16 though the right value is 8. This happens occasionally which seems a bug. Closes https://github.com/facebook/rocksdb/pull/2160 Differential Revision: D4893542 Pulled By: lightmark fbshipit-source-id: 68e832586b58bbc6162efbe83ce273f1570d5be3
This commit is contained in:
parent
95c5e2dc6e
commit
1265ed7abb
10
env/io_posix.cc
vendored
10
env/io_posix.cc
vendored
@ -772,17 +772,9 @@ Status PosixWritableFile::Close() {
|
|||||||
fstat(fd_, &file_stats);
|
fstat(fd_, &file_stats);
|
||||||
// After ftruncate, we check whether ftruncate has the correct behavior.
|
// After ftruncate, we check whether ftruncate has the correct behavior.
|
||||||
// If not, we should hack it with FALLOC_FL_PUNCH_HOLE
|
// If not, we should hack it with FALLOC_FL_PUNCH_HOLE
|
||||||
static bool buggy = false;
|
if ((file_stats.st_size + file_stats.st_blksize - 1) /
|
||||||
if (!buggy && (file_stats.st_size + file_stats.st_blksize - 1) /
|
|
||||||
file_stats.st_blksize !=
|
file_stats.st_blksize !=
|
||||||
file_stats.st_blocks / (file_stats.st_blksize / 512)) {
|
file_stats.st_blocks / (file_stats.st_blksize / 512)) {
|
||||||
fprintf(stderr,
|
|
||||||
"WARNING: Your kernel may be buggy (<= 4.0.x) and does not free "
|
|
||||||
"preallocated blocks on truncate. Hacking around it, but you "
|
|
||||||
"should upgrade!\n");
|
|
||||||
buggy = true;
|
|
||||||
}
|
|
||||||
if (buggy) {
|
|
||||||
IOSTATS_TIMER_GUARD(allocate_nanos);
|
IOSTATS_TIMER_GUARD(allocate_nanos);
|
||||||
if (allow_fallocate_) {
|
if (allow_fallocate_) {
|
||||||
fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_,
|
fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_,
|
||||||
|
Loading…
Reference in New Issue
Block a user