diff --git a/platform/platform.hpp b/platform/platform.hpp index 8afb79efa4..21796d0dca 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -243,7 +243,6 @@ public: NOT_ENOUGH_SPACE }; TStorageStatus GetWritableStorageStatus(uint64_t neededSize) const; - uint64_t GetWritableStorageSpace() const; // Please note, that number of active cores can vary at runtime. // DO NOT assume for the same return value between calls. diff --git a/platform/platform_unix_impl.cpp b/platform/platform_unix_impl.cpp index af77d44b55..a5bf894b67 100644 --- a/platform/platform_unix_impl.cpp +++ b/platform/platform_unix_impl.cpp @@ -124,28 +124,14 @@ Platform::TStorageStatus Platform::GetWritableStorageStatus(uint64_t neededSize) return STORAGE_DISCONNECTED; } - /// @todo May be add additional storage space. - if (st.f_bsize * st.f_bavail < neededSize) + auto const availableBytes = st.f_bsize * st.f_bavail; + LOG(LDEBUG, ("Free space check: requested =", neededSize, "; available =", availableBytes)); + if (availableBytes < neededSize) return NOT_ENOUGH_SPACE; return STORAGE_OK; } -uint64_t Platform::GetWritableStorageSpace() const -{ - struct statfs st; - int const ret = statfs(m_writableDir.c_str(), &st); - - LOG(LDEBUG, ("statfs return =", ret, - "; block size =", st.f_bsize, - "; blocks available =", st.f_bavail)); - - if (ret != 0) - LOG(LERROR, ("Path:", m_writableDir, "statfs error:", ErrnoToError())); - - return (ret != 0) ? 0 : st.f_bsize * st.f_bavail; -} - namespace pl {