aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-04-01 15:39:49 +0200
committerDan Engelbrecht <[email protected]>2022-04-01 15:39:49 +0200
commit98c7fd153f4d25f13b8e4bc81648b02f80698c93 (patch)
tree3a6ce7256abe702b3a0130b37d61324bdb48edc1 /zenstore/gc.cpp
parentfix BasicFile::Open on Linux (diff)
downloadzen-98c7fd153f4d25f13b8e4bc81648b02f80698c93.tar.xz
zen-98c7fd153f4d25f13b8e4bc81648b02f80698c93.zip
make sure we allocate disk space when we set file size
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp8
1 files changed, 8 insertions, 0 deletions
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