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

cov: widen before calculating min_chunk_size

Although we expect min_chunk_size to be 32bit value, for
large size of caches it might be useful to do calcs 64bit.
So to avoid doing shift as signed 32bit - use unsigned 64bit
from the start.
This commit is contained in:
Zdenek Kabelac 2020-01-30 12:43:53 +01:00
parent de43527f94
commit d6ac039b65

View File

@ -222,7 +222,7 @@ int update_cache_pool_params(struct cmd_context *cmd,
*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));
min_chunk_size = UINT64_C(1) << (32 - clz(min_chunk_size - 1));
}
if (*chunk_size < min_chunk_size) {
/*