diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-10-26 18:17:59 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-10-26 18:37:13 +0100 |
commit | 52dfa6dd4491fd6f584b83d0924b82bea3bc1092 (patch) | |
tree | b851f2f217a9ff27e324199f69ab0e1788eee2c9 | |
parent | 25307e4add1e3f25cf5ae00d942df61afa46fe60 (diff) | |
download | lvm2-52dfa6dd4491fd6f584b83d0924b82bea3bc1092.tar.gz |
cache: apply chunk rounding also for cache creation.
When we create volumes with chunk size bigger then extent size
we try to round up to some nearest chunk boundary.
Until now we did this for thins - use same logic for
cache volumes.
-rw-r--r-- | lib/metadata/lv_manip.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 8523b58a7..b12af6cd5 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -3017,7 +3017,6 @@ int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status, struct lv_segment *seg; struct logical_volume *thin_pool_lv = NULL; struct lv_list *lvl; - uint32_t size; if (thin_pool_name) { if (!(lvl = find_lv_in_vg(lv->vg, thin_pool_name))) { @@ -3026,17 +3025,6 @@ int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status, return 0; } thin_pool_lv = lvl->lv; - size = first_seg(thin_pool_lv)->chunk_size; - if (lv->vg->extent_size < size) { - /* Align extents on chunk boundary size */ - size = ((uint64_t)lv->vg->extent_size * extents + size - 1) / - size * size / lv->vg->extent_size; - if (size != extents) { - log_print_unless_silent("Rounding size (%d extents) up to chunk boundary " - "size (%d extents).", extents, size); - extents = size; - } - } } if (!dm_list_empty(&lv->segments) && @@ -6722,6 +6710,20 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, display_lvname(pool_lv)); return NULL; } + + /* Validate volume size to to aling on chunk for small extents */ + /* Cache chunk size is always set */ + size = seg_is_cache(lp) ? lp->chunk_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; + } + } } /* Resolve origin volume */ |