summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2019-01-28 20:08:49 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2019-01-28 22:17:14 +0100
commit58ad831c72b024233d91980f2269d0a26101ff99 (patch)
tree2b373ef38d26119caebe4e06b09a496588e6b328
parentcbf62b9262d493a5df9ab5a57e68395465d4701a (diff)
downloadlvm2-58ad831c72b024233d91980f2269d0a26101ff99.tar.gz
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.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/metadata/cache_manip.c5
2 files changed, 5 insertions, 1 deletions
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,