From 58ad831c72b024233d91980f2269d0a26101ff99 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 28 Jan 2019 20:08:49 +0100 Subject: [PATCH] cache: select chunk size as power of 2 When cache chunk size is not configured, and left for lvm deduction, select the value which is power-of-2. --- WHATS_NEW | 1 + lib/metadata/cache_manip.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 06848ea15..90739c9cc 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.03.02 - =================================== + Cache selects power-of-2 chunk size by default. Support reszing for VDOPoolLV and VDOLV. Improve -lXXX%VG modifier which improves cache segment estimation. Ensure migration_threshold for cache is at least 8 chunks. diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c index 656e49dda..ee2a5c528 100644 --- a/lib/metadata/cache_manip.c +++ b/lib/metadata/cache_manip.c @@ -215,9 +215,12 @@ int update_cache_pool_params(struct cmd_context *cmd, if (!*chunk_size) { if (!(*chunk_size = find_config_tree_int(cmd, allocation_cache_pool_chunk_size_CFG, - profile) * 2)) + profile) * 2)) { *chunk_size = get_default_allocation_cache_pool_chunk_size_CFG(cmd, profile); + /* Use power-of-2 for min chunk size when unspecified */ + min_chunk_size = 1 << (32 - clz(min_chunk_size - 1)); + } if (*chunk_size < min_chunk_size) { /* * When using more then 'standard' default,