aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsath <sath@yandex-team.com>2024-06-20 11:56:38 +0300
committersath <sath@yandex-team.com>2024-06-20 12:09:26 +0300
commit21a06b21f58177b7fce835838bc38d7228ac7e03 (patch)
treee6e4e220945e5738038980eec44d0213096c0fae
parentc17401ef02ee2224b96ff226750565ed5506c3d0 (diff)
downloadydb-21a06b21f58177b7fce835838bc38d7228ac7e03.tar.gz
Implement TFile::Fallocate for Windows.
66f69cf2778ef870c0ddb050d260160ce8be1c3f
-rw-r--r--util/system/file.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/system/file.cpp b/util/system/file.cpp
index d9acde845d..30bba71a03 100644
--- a/util/system/file.cpp
+++ b/util/system/file.cpp
@@ -446,6 +446,12 @@ bool TFileHandle::FallocateNoResize(i64 length) noexcept {
}
#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21)
return !fallocate(Fd_, FALLOC_FL_KEEP_SIZE, 0, length);
+#elif defined(_win_)
+ FILE_ALLOCATION_INFO allocInfo = {};
+ allocInfo.AllocationSize.QuadPart = length;
+
+ return SetFileInformationByHandle(Fd_, FileAllocationInfo, &allocInfo,
+ sizeof(FILE_ALLOCATION_INFO));
#else
Y_UNUSED(length);
return true;