Skip to content

Commit

Permalink
Use MiB and change default to 5% of available space
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Passaro <[email protected]>
  • Loading branch information
passaro committed Nov 17, 2023
1 parent 447db75 commit 307fec0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mountpoint-s3/src/data_cache/disk_data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Default for DiskDataCacheConfig {
fn default() -> Self {
Self {
block_size: 1024 * 1024, // 1 MiB block size
limit: CacheLimit::AvailableSpace { min_ratio: 0.01 }, // Preserve 1% available space
limit: CacheLimit::AvailableSpace { min_ratio: 0.05 }, // Preserve 5% available space
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions mountpoint-s3/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ struct CliArgs {
#[cfg(feature = "caching")]
#[clap(
long,
help = "Maximum size of the cache directory in MB [default: preserve 1% of available space]",
value_name = "MB",
help = "Maximum size of the cache directory in MiB [default: preserve 5% of available space]",
value_name = "MiB",
value_parser = value_parser!(u64).range(1..),
help_heading = CACHING_OPTIONS_HEADER,
requires = "cache",
Expand Down Expand Up @@ -574,9 +574,9 @@ fn mount(args: CliArgs) -> anyhow::Result<FuseSession> {
};

let mut cache_config = DiskDataCacheConfig::default();
if let Some(max_size_in_mb) = args.max_cache_size {
if let Some(max_size_in_mib) = args.max_cache_size {
cache_config.limit = CacheLimit::TotalSize {
max_size: (max_size_in_mb * 1_000_000) as usize,
max_size: (max_size_in_mib * 1024 * 1024) as usize,
};
}
let cache = DiskDataCache::new(path, cache_config);
Expand Down

0 comments on commit 307fec0

Please sign in to comment.