1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

cleanup: relocate size assign

Directly set thin-pool size when thin data LV size changes.
This commit is contained in:
Zdenek Kabelac 2016-01-18 23:22:48 +01:00
parent ca878a3426
commit b64703401d

View File

@ -1730,7 +1730,7 @@ static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status,
uint32_t region_size)
{
uint32_t s, extents, area_multiple;
struct lv_segment *seg;
struct lv_segment *seg, *thin_pool_seg;
area_multiple = _calc_area_multiple(segtype, area_count, 0);
extents = aa[0].len * area_multiple;
@ -1753,6 +1753,15 @@ static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status,
lv->le_count += extents;
lv->size += (uint64_t) extents * lv->vg->extent_size;
if (lv_is_thin_pool_data(lv)) {
/* Update thin pool segment from the layered LV */
thin_pool_seg = get_only_segment_using_this_lv(lv);
thin_pool_seg->lv->le_count =
thin_pool_seg->len =
thin_pool_seg->area_len = lv->le_count;
thin_pool_seg->lv->size = lv->size;
}
return 1;
}
@ -5239,11 +5248,6 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
display_size(cmd, (uint64_t) lv->le_count * vg->extent_size), lv->le_count);
if (lock_lv) {
/* Update thin pool segment from the layered LV */
seg->area_len = lv->le_count;
seg->len = lv->le_count;
lock_lv->le_count = lv->le_count;
lock_lv->size = lv->size;
/* If thin metadata, must suspend thin pool */
} else if (lv_is_thin_pool_metadata(lv)) {
if (!(lock_lv = find_pool_lv(lv)))