aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authoreasergeev <easergeev@yandex-team.ru>2022-02-10 16:51:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:51:45 +0300
commit2db97242fffe2a2e7fcfb321249fbb3ade943210 (patch)
tree7704c05183f852edb43c4cc9f81b33bdf8474f9e /util
parent3288844da9a26e598b08a1f4c2362603bcf1f506 (diff)
downloadydb-2db97242fffe2a2e7fcfb321249fbb3ade943210.tar.gz
Restoring authorship annotation for <easergeev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/system/direct_io.h16
-rw-r--r--util/system/file.cpp88
-rw-r--r--util/system/file.h8
-rw-r--r--util/system/fstat.cpp4
-rw-r--r--util/system/fstat.h2
5 files changed, 59 insertions, 59 deletions
diff --git a/util/system/direct_io.h b/util/system/direct_io.h
index 6a3325a960..9ddc6bc50a 100644
--- a/util/system/direct_io.h
+++ b/util/system/direct_io.h
@@ -37,14 +37,14 @@ public:
return File.GetHandle();
}
- inline void FallocateNoResize(ui64 length) {
- File.FallocateNoResize(length);
- }
-
- inline void ShrinkToFit() {
- File.ShrinkToFit();
- }
-
+ inline void FallocateNoResize(ui64 length) {
+ File.FallocateNoResize(length);
+ }
+
+ inline void ShrinkToFit() {
+ File.ShrinkToFit();
+ }
+
private:
inline bool IsAligned(i64 value) {
return Alignment ? value == AlignDown<i64>(value, Alignment) : true;
diff --git a/util/system/file.cpp b/util/system/file.cpp
index 4a261d020c..d857e34fd9 100644
--- a/util/system/file.cpp
+++ b/util/system/file.cpp
@@ -27,11 +27,11 @@
#if defined(_unix_)
#include <fcntl.h>
-
+
#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21) && !defined(FALLOC_FL_KEEP_SIZE)
#include <linux/falloc.h>
#endif
-
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
@@ -388,30 +388,30 @@ bool TFileHandle::Reserve(i64 length) noexcept {
return true;
}
-bool TFileHandle::FallocateNoResize(i64 length) noexcept {
- if (!IsOpen()) {
- return false;
- }
-#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21)
- return !fallocate(Fd_, FALLOC_FL_KEEP_SIZE, 0, length);
-#else
- Y_UNUSED(length);
- return true;
-#endif
-}
-
-// Pair for FallocateNoResize
-bool TFileHandle::ShrinkToFit() noexcept {
- if (!IsOpen()) {
- return false;
- }
-#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21)
+bool TFileHandle::FallocateNoResize(i64 length) noexcept {
+ if (!IsOpen()) {
+ return false;
+ }
+#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21)
+ return !fallocate(Fd_, FALLOC_FL_KEEP_SIZE, 0, length);
+#else
+ Y_UNUSED(length);
+ return true;
+#endif
+}
+
+// Pair for FallocateNoResize
+bool TFileHandle::ShrinkToFit() noexcept {
+ if (!IsOpen()) {
+ return false;
+ }
+#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21)
return !ftruncate(Fd_, (off_t)GetLength());
-#else
+#else
return true;
-#endif
-}
-
+#endif
+}
+
bool TFileHandle::Flush() noexcept {
if (!IsOpen()) {
return false;
@@ -898,18 +898,18 @@ public:
}
}
- void FallocateNoResize(i64 length) {
- if (!Handle_.FallocateNoResize(length)) {
- ythrow TFileError() << "can't allocate " << length << "bytes of space for file " << FileName_.Quote();
- }
- }
-
- void ShrinkToFit() {
- if (!Handle_.ShrinkToFit()) {
- ythrow TFileError() << "can't shrink " << FileName_.Quote() << " to logical size";
- }
- }
-
+ void FallocateNoResize(i64 length) {
+ if (!Handle_.FallocateNoResize(length)) {
+ ythrow TFileError() << "can't allocate " << length << "bytes of space for file " << FileName_.Quote();
+ }
+ }
+
+ void ShrinkToFit() {
+ if (!Handle_.ShrinkToFit()) {
+ ythrow TFileError() << "can't shrink " << FileName_.Quote() << " to logical size";
+ }
+ }
+
void Flush() {
if (!Handle_.Flush()) {
ythrow TFileError() << "can't flush " << FileName_.Quote();
@@ -1145,14 +1145,14 @@ void TFile::Reserve(i64 length) {
Impl_->Reserve(length);
}
-void TFile::FallocateNoResize(i64 length) {
- Impl_->FallocateNoResize(length);
-}
-
-void TFile::ShrinkToFit() {
- Impl_->ShrinkToFit();
-}
-
+void TFile::FallocateNoResize(i64 length) {
+ Impl_->FallocateNoResize(length);
+}
+
+void TFile::ShrinkToFit() {
+ Impl_->ShrinkToFit();
+}
+
void TFile::Flush() {
Impl_->Flush();
}
diff --git a/util/system/file.h b/util/system/file.h
index 9502e159b6..dab2cc66f3 100644
--- a/util/system/file.h
+++ b/util/system/file.h
@@ -108,8 +108,8 @@ public:
i64 Seek(i64 offset, SeekDir origin) noexcept;
bool Resize(i64 length) noexcept;
bool Reserve(i64 length) noexcept;
- bool FallocateNoResize(i64 length) noexcept;
- bool ShrinkToFit() noexcept;
+ bool FallocateNoResize(i64 length) noexcept;
+ bool ShrinkToFit() noexcept;
bool Flush() noexcept;
//flush data only, without file metadata
bool FlushData() noexcept;
@@ -164,8 +164,8 @@ public:
i64 Seek(i64 offset, SeekDir origin);
void Resize(i64 length);
void Reserve(i64 length);
- void FallocateNoResize(i64 length);
- void ShrinkToFit();
+ void FallocateNoResize(i64 length);
+ void ShrinkToFit();
void Flush();
void FlushData();
diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp
index 81e98cbc6b..a09b0a8f72 100644
--- a/util/system/fstat.cpp
+++ b/util/system/fstat.cpp
@@ -51,7 +51,7 @@ static void MakeStat(TFileStat& st, const TSystemFStat& fs) {
st.Uid = fs.st_uid;
st.Gid = fs.st_gid;
st.Size = fs.st_size;
- st.AllocationSize = fs.st_blocks * 512;
+ st.AllocationSize = fs.st_blocks * 512;
st.ATime = fs.st_atime;
st.MTime = fs.st_mtime;
st.CTime = fs.st_ctime;
@@ -69,7 +69,7 @@ static void MakeStat(TFileStat& st, const TSystemFStat& fs) {
st.Uid = 0;
st.Gid = 0;
st.Size = ((ui64)fs.nFileSizeHigh << 32) | fs.nFileSizeLow;
- st.AllocationSize = st.Size; // FIXME
+ st.AllocationSize = st.Size; // FIXME
st.INode = ((ui64)fs.nFileIndexHigh << 32) | fs.nFileIndexLow;
#endif
}
diff --git a/util/system/fstat.h b/util/system/fstat.h
index 64e79e1b55..62ef0f4c5b 100644
--- a/util/system/fstat.h
+++ b/util/system/fstat.h
@@ -14,7 +14,7 @@ struct TFileStat {
ui64 NLinks = 0; /* number of hard links */
ui64 Size = 0; /* total size, in bytes */
ui64 INode = 0; /* inode number */
- ui64 AllocationSize = 0; /* number of bytes allocated on the disk */
+ ui64 AllocationSize = 0; /* number of bytes allocated on the disk */
time_t ATime = 0; /* time of last access */
time_t MTime = 0; /* time of last modification */