From 298d12c4590ccca26b92e1457c72c6369a32d3e9 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 9 Mar 2017 17:15:56 +0100 Subject: [PATCH] lvcreate: do not round cache volumes on cache chunks Since cache chunk might be huge and there is no technical need to enforce rounding and there is actually more 'real' VG space used then necessary - keep rounding on 'chunk' bounrary only for thin volumes - where it's the space used anyway. NB: we support conversion of any-size 'existing' LV into cached LV. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 00465cc82..61b01b64f 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Skip rounding on cache chunk size boudary when create cache LV. Improve cache_set_params support for chunk_size selection. Fix metadata profile allocation/cache_[mode|policy] setting. Fix missing support for using allocation/cache_pool_chunk_size setting. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 5ef9d73f8..120eb58b9 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -7402,21 +7402,20 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, return NULL; } - /* Validate volume size to to aling on chunk for small extents */ - /* Cache chunk size is always set */ - size = first_seg(pool_lv)->chunk_size; - if (size > vg->extent_size) { - /* Align extents on chunk boundary size */ - size = ((uint64_t)vg->extent_size * lp->extents + size - 1) / - size * size / vg->extent_size; - if (size != lp->extents) { - log_print_unless_silent("Rounding size (%d extents) up to chunk boundary " - "size (%d extents).", lp->extents, size); - lp->extents = size; - } - } - if (seg_is_thin_volume(lp)) { + /* Validate volume size to to aling on chunk for small extents */ + size = first_seg(pool_lv)->chunk_size; + if (size > vg->extent_size) { + /* Align extents on chunk boundary size */ + size = ((uint64_t)vg->extent_size * lp->extents + size - 1) / + size * size / vg->extent_size; + if (size != lp->extents) { + log_print_unless_silent("Rounding size (%d extents) up to chunk boundary " + "size (%d extents).", lp->extents, size); + lp->extents = size; + } + } + thin_pool_was_active = lv_is_active(pool_lv); if (lv_is_new_thin_pool(pool_lv)) { if (!check_new_thin_pool(pool_lv))