1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
David Teigland 2019-10-21 12:13:33 -05:00
parent 018cf39316
commit c08704cee7

View File

@ -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;