Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions be/src/io/cache/block_file_cache_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ Status FileCacheFactory::create_file_cache(const std::string& cache_base_path,
LOG_ERROR("").tag("file cache path", cache_base_path).tag("error", strerror(errno));
return Status::IOError("{} statfs error {}", cache_base_path, strerror(errno));
}
#ifdef __APPLE__
const auto block_size = stat.f_bsize;
#else
const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize;
#endif
size_t disk_capacity = static_cast<size_t>(static_cast<size_t>(stat.f_blocks) *
static_cast<size_t>(block_size));
if (file_cache_settings.capacity == 0 || disk_capacity < file_cache_settings.capacity) {
Expand Down Expand Up @@ -289,7 +293,11 @@ std::string validate_capacity(const std::string& path, int64_t new_capacity,
valid_capacity = 0; // caller will handle the error
return ret;
}
#ifdef __APPLE__
const auto block_size = stat.f_bsize;
#else
const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize;
#endif
size_t disk_capacity = static_cast<size_t>(static_cast<size_t>(stat.f_blocks) *
static_cast<size_t>(block_size));
if (new_capacity == 0 || disk_capacity < new_capacity) {
Expand Down
Loading