From 307fec022392fa29a13afffd11f84160e92cf2da Mon Sep 17 00:00:00 2001 From: Alessandro Passaro Date: Fri, 17 Nov 2023 16:26:50 +0000 Subject: [PATCH] Use MiB and change default to 5% of available space Signed-off-by: Alessandro Passaro --- mountpoint-s3/src/data_cache/disk_data_cache.rs | 2 +- mountpoint-s3/src/main.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mountpoint-s3/src/data_cache/disk_data_cache.rs b/mountpoint-s3/src/data_cache/disk_data_cache.rs index 460cf8741..fa6e247ab 100644 --- a/mountpoint-s3/src/data_cache/disk_data_cache.rs +++ b/mountpoint-s3/src/data_cache/disk_data_cache.rs @@ -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 } } } diff --git a/mountpoint-s3/src/main.rs b/mountpoint-s3/src/main.rs index 441a03d03..985b1cc2c 100644 --- a/mountpoint-s3/src/main.rs +++ b/mountpoint-s3/src/main.rs @@ -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", @@ -574,9 +574,9 @@ fn mount(args: CliArgs) -> anyhow::Result { }; 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);