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

thin: max thin

This commit is contained in:
Zdenek Kabelac 2019-01-29 18:45:52 +01:00
parent 74b5f22838
commit 1cc690e911
2 changed files with 10 additions and 3 deletions

View File

@ -124,6 +124,8 @@
#define DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY "generic"
#define DEFAULT_THIN_POOL_CHUNK_SIZE 64 /* KB */
#define DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE 512 /* KB */
/* Chunk size big enough it no longer needs jump by power-of-2 */
#define DEFAULT_THIN_POOL_CHUNK_SIZE_ALIGNED 1024 /* KB */
#define DEFAULT_THIN_POOL_DISCARDS "passdown"
#define DEFAULT_THIN_POOL_ZERO 1
#define DEFAULT_POOL_METADATA_SPARE 1 /* thin + cache */

View File

@ -577,10 +577,15 @@ static uint32_t _estimate_chunk_size(uint32_t data_extents, uint32_t extent_size
uint64_t metadata_size, int attr)
{
uint32_t chunk_size = _estimate_size(data_extents, extent_size, metadata_size);
const uint32_t BIG_CHUNK = 2 * DEFAULT_THIN_POOL_CHUNK_SIZE_ALIGNED - 1;
/* Always round up to nearest power of 2 of 32-bit,
* even when pool supports multiple of 64KiB */
chunk_size = 1 << (32 - clz(chunk_size - 1));
if ((attr & THIN_FEATURE_BLOCK_SIZE) &&
(chunk_size > BIG_CHUNK) &&
(chunk_size < (UINT32_MAX - BIG_CHUNK)))
chunk_size = (chunk_size + BIG_CHUNK) & ~BIG_CHUNK;
else
/* Round up to nearest power of 2 of 32-bit */
chunk_size = 1 << (32 - clz(chunk_size - 1));
if (chunk_size < DM_THIN_MIN_DATA_BLOCK_SIZE)
chunk_size = DM_THIN_MIN_DATA_BLOCK_SIZE;