From: David Teigland Date: Mon, 21 Oct 2019 17:13:33 +0000 (-0500) Subject: cachevol: use cachepool code for metadata size X-Git-Tag: v2_03_06~10 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=c08704cee7e34a96fdaa453faf900683283e8691;p=lvm2.git cachevol: use cachepool code for metadata size Based on a more detailed calculation, but because of extent size rounding, the final result is about the same. --- diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c index c20cc49ba..2f35d835c 100644 --- a/lib/metadata/cache_manip.c +++ b/lib/metadata/cache_manip.c @@ -1092,32 +1092,8 @@ int cache_vol_set_params(struct cmd_context *cmd, } } - /* - * cachevol size 8M to 16M -> metadata size 4M - * - * cachevol size 16M to 4G -> metadata size 8M - * - * cachevol size 4G to 16G -> metadata size 16M - * - * cachevol size 16G to 32G -> metadata size 32M - * - * cachevol size 32G and up -> metadata size 64M - */ if (!meta_size) { - if (pool_lv->size <= (16 * ONE_MB_IN_SECTORS)) - meta_size = 4 * ONE_MB_IN_SECTORS; - - else if (pool_lv->size <= (4 * ONE_GB_IN_SECTORS)) - meta_size = 8 * ONE_MB_IN_SECTORS; - - else if (pool_lv->size <= (16 * ONE_GB_IN_SECTORS)) - meta_size = 16 * ONE_MB_IN_SECTORS; - - else if (pool_lv->size <= (32 * ONE_GB_IN_SECTORS)) - meta_size = 32 * ONE_MB_IN_SECTORS; - - else - meta_size = 64 * ONE_MB_IN_SECTORS; + meta_size = _cache_min_metadata_size(pool_lv->size, chunk_size); if (meta_size < min_meta_size) meta_size = min_meta_size;