]> sourceware.org Git - lvm2.git/commitdiff
Fix lvresize for thin pool
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 11 Apr 2012 12:40:03 +0000 (12:40 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 11 Apr 2012 12:40:03 +0000 (12:40 +0000)
When resizing thin pool - we need to use strip info from  _tdata volume.
In future more generic solution will be necessary once we start to support
lvconvert (resize of stacked devices and stay properly aligned).
For now we just allow striped or linear LV so this code will work.

WHATS_NEW
tools/lvresize.c

index 7f63680b78e7f83e9007021a93fb180d8efd5d0b..2063f20239be27f87520216ca1792da6d564c4dc 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.96 - 
 ================================
+  Fix lvresize of thin pool for stipped devices.
   For lvresize round upward when specifying number of extents.
   For lvcreate with %FREE support rounding downward strip alignment.
   Change message severity to log_very_verbose for missing dev info in udev db.
index b71720e3ca328dd2caa4932f1a4b64936268cba0..4acdda2263505e13a569b80ea1caffa5129befee 100644 (file)
@@ -590,7 +590,10 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
        if ((lp->extents > lv->le_count) &&
            !(lp->stripes == 1 || (lp->stripes > 1 && lp->stripe_size))) {
                /* FIXME Don't assume mirror seg will always be AREA_LV */
-               dm_list_iterate_items(seg, seg_mirrors ? &seg_lv(mirr_seg, 0)->segments : &lv->segments) {
+               /* FIXME We will need to support resize for metadata LV as well,
+                *       and data LV could be any type (i.e. mirror)) */
+               dm_list_iterate_items(seg, seg_mirrors ? &seg_lv(mirr_seg, 0)->segments :
+                                     lv_is_thin_pool(lv) ? &seg_lv(first_seg(lv), 0)->segments : &lv->segments) {
                        if (!seg_is_striped(seg))
                                continue;
 
@@ -739,13 +742,6 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
                        log_warn("Thin pool volumes do not have filesystem.");
                        lp->resizefs = 0;
                }
-
-               if (!lp->stripes) {
-                       /* Try to use the same strip settings for underlying pool data LV */
-                       lp->stripes = last_seg(seg_lv(first_seg(lv), 0))->area_count;
-                       if (!lp->stripe_size)
-                               lp->stripe_size = last_seg(seg_lv(first_seg(lv), 0))->stripe_size;
-               }
        }
 
        if ((lp->resize == LV_REDUCE) && lp->argc)
This page took 0.075528 seconds and 5 git commands to generate.