diff options
Diffstat (limited to 'zenstore')
| -rw-r--r-- | zenstore/basicfile.cpp | 4 | ||||
| -rw-r--r-- | zenstore/gc.cpp | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp index 042f0aa43..93d4ded13 100644 --- a/zenstore/basicfile.cpp +++ b/zenstore/basicfile.cpp @@ -329,9 +329,11 @@ BasicFile::SetFileSize(uint64_t FileSize) #elif ZEN_PLATFORM_MAC int Fd = int(intptr_t(m_FileHandle)); ftruncate(Fd, (off_t)FileSize); + posix_fallocate(Fd, 0, (off_t)FileSize); #else - int Fd = int(intptr_t(m_FileHandle)); + posix_fallocate(Fd, 0, ) int Fd = int(intptr_t(m_FileHandle)); ftruncate64(Fd, (off64_t)FileSize); + posix_fallocate64(Fd, 0, (off64_t)FileSize); #endif } diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp index ab7eece20..a37fc2f5b 100644 --- a/zenstore/gc.cpp +++ b/zenstore/gc.cpp @@ -123,11 +123,19 @@ namespace { { return zen::MakeErrorCodeFromLastError(); } + if (posix_fallocate(Fd, 0, (off_t)FileSize) < 0) + { + return zen::MakeErrorCodeFromLastError(); + } # else if (ftruncate64(Fd, (off64_t)FileSize) < 0) { return zen::MakeErrorCodeFromLastError(); } + if (posix_fallocate64(Fd, 0, (off64_t)FileSize) < 0) + { + return zen::MakeErrorCodeFromLastError(); + } # endif Keep = true; #endif |