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

Fit thin pool metadata into 128MB

If the lvcreate may decide some automagical values for a user,
try to keep the pool metadata size into 128MB range for optimal
perfomance (as suggested by Joe).

So if the pool metadata size and chunk_size were not specified,
try to select such values they would fit into 128MB size.
This commit is contained in:
Zdenek Kabelac 2012-03-05 14:19:13 +00:00
parent 975b5b42d2
commit 90423c1200
3 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.95 -
================================
Try to fit thin pool metadata size into 128MB.
Print just warning on thin pool check callback path for failing check.
Use 64bit math for verification of thin pool and snapshot chunk size.
Validate udev structures in _insert_udev_dir().

View File

@ -68,6 +68,7 @@
#define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
#define DEFAULT_THIN_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
#define DEFAULT_THIN_POOL_MIN_METADATA_SIZE 2048 /* KB */
#define DEFAULT_THIN_POOL_OPTIMAL_SIZE (128 * 1024 * 1024) /* KB */
#define DEFAULT_UMASK 0077

View File

@ -235,6 +235,7 @@ static int _update_extents_params(struct volume_group *vg,
{
uint32_t pv_extent_count;
struct logical_volume *origin = NULL;
int changed = 0;
if (lcp->size &&
!(lp->extents = extents_from_size(vg->cmd, lcp->size,
@ -294,11 +295,26 @@ static int _update_extents_params(struct volume_group *vg,
}
if (lp->create_thin_pool) {
if (!arg_count(vg->cmd, poolmetadatasize_ARG))
if (!arg_count(vg->cmd, poolmetadatasize_ARG)) {
/* Defaults to nr_pool_blocks * 64b */
lp->poolmetadatasize = (uint64_t) lp->extents * vg->extent_size /
(uint64_t) (lp->chunk_size * (SECTOR_SIZE / UINT64_C(64)));
/* Check if we could eventually use bigger chunk size */
if (!arg_count(vg->cmd, chunksize_ARG)) {
while ((lp->poolmetadatasize >
(DEFAULT_THIN_POOL_OPTIMAL_SIZE / SECTOR_SIZE)) &&
(lp->chunk_size < DM_THIN_MAX_DATA_BLOCK_SIZE)) {
lp->chunk_size <<= 1;
lp->poolmetadatasize >>= 1;
changed++;
}
if (changed)
log_verbose("Changed chunksize to %u sectors.",
lp->chunk_size);
}
}
if (lp->poolmetadatasize > (2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE)) {
if (arg_count(vg->cmd, poolmetadatasize_ARG))
log_warn("WARNING: Maximum supported pool metadata size is 16GB.");