This commit is contained in:
2024-12-25 11:52:05 -06:00
parent 3587b47edd
commit 76a7b3eaf0

View File

@ -122,13 +122,14 @@ open_file::~open_file() { close(); }
auto open_file::adjust_cache_size(std::uint64_t file_size, bool shrink)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
if (file_size == fsi_.size) {
return api_error::success;
}
if (file_size > fsi_.size) {
auto size = file_size - file_size.value();
auto size = file_size - file_size;
auto res = shrink ? cache_size_mgr::instance().shrink(size)
: cache_size_mgr::instance().expand(size);
if (res == api_error::success) {
@ -178,7 +179,7 @@ auto open_file::check_allocation() -> api_error {
}
file_lock.unlock();
res = adjust_cache_size(file_size.value(), true);
auto res = adjust_cache_size(file_size.value(), true);
if (res != api_error::success) {
return res;
}