[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [LVM2 PATCH] (1/5) Fix existing mirrors calculation in lvconvert

This patch fixes lvconvert_mirrors() to calculate the existing_mirrors
even if the LV is striped.

The bug isn't visible because currently lvconvert restricts the
conversion of striped LV.
However, with this patch, the restriction can be removed.

Jun'ichi Nomura, NEC Corporation of America
Fix 'existing_mirrors' to get the number of mirrors even if the LV is striped.

seg->area_count holds:
  - the number of mirrors for mirrored segment
  - the number of stripes for striped segment (i.e. 1 for linear LV)

seg->area_count could be more than 1 if the segment is striped.
So it should check lv->status before looking at seg->area_count.

It used not to be a problem because the function checks lv->status
later and reject to work if it's not MIRRORED.

With this patch, the following FIXME can be removed,
though the allowed configuration is not still very useful yet.

        /* FIXME Why is this restriction here?  Fix it! */
        list_iterate_items(seg, &lv->segments) {
                if (seg_is_striped(seg) && seg->area_count > 1) {
                        log_error("Mirrors of striped volumes are
                                   not yet supported.");
                        return 0;

Index: LVM2.work/tools/lvconvert.c
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -242,7 +242,7 @@ static int lvconvert_mirrors(struct cmd_
 	unsigned corelog = 0;
 	seg = first_seg(lv);
-	existing_mirrors = seg->area_count;
+	existing_mirrors = lv->status & MIRRORED ? seg->area_count : 1;
 	 * Adjust required number of mirrors

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]