Skip to contentSkip to conversation

master - raid: Infrastructure for raid takeover.

PATCH Alasdair Kergon 1 participant 1 message Jun 28, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=79446ffad7358dd8c130ff498514150d1e0ea08b
Commit:        79446ffad7358dd8c130ff498514150d1e0ea08b
Parent:        ff3c4ed1c0e2e554e9fb5f9b7ff20fdf5a835852
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Tue Jun 28 02:42:30 2016 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Tue Jun 28 02:42:30 2016 +0100

raid: Infrastructure for raid takeover.

---
 WHATS_NEW                        |    1 +
 lib/config/defaults.h            |    3 +-
 lib/metadata/metadata-exported.h |    1 -
 lib/metadata/raid_manip.c        |  490 ++++++++++++++++++++++++++++++++++++--
 lib/metadata/takeover_matrix.h   |  120 ++++++++++
 tools/lvconvert.c                |    7 +-
 6 files changed, 596 insertions(+), 26 deletions(-)
WHATS_NEW +1 -0
index cfa707f..3184412 100644
@@ -1,5 +1,6 @@
 Version 2.02.159 - 
 =================================
+  Add infrastructure for raid takeover lvconvert options.
 
 Version 2.02.158 - 25th June 2016
 =================================
lib/config/defaults.h +2 -1
index 3d449ff..addb14f 100644
@@ -66,7 +66,8 @@
 #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
 #define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"
 #define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */
-#define DEFAULT_RAID_MAX_IMAGES 8
+// FIXME Increase this to 64
+#define DEFAULT_RAID_MAX_IMAGES 8 /* limited by kernel failed devices bitfield in superblock (raid4/5/6 max 253) */
 
 #define DEFAULT_RAID_FAULT_POLICY "warn"
 
lib/metadata/metadata-exported.h +0 -1
index f47fa1d..7765d23 100644
@@ -1196,7 +1196,6 @@ int lv_raid_merge(struct logical_volume *lv);
 int lv_raid_convert(struct logical_volume *lv,
 		    const struct segment_type *new_segtype,
 		    int yes, int force,
-		    const unsigned image_count,
 		    const unsigned stripes,
 		    const unsigned new_stripe_size,
 		    struct dm_list *allocate_pvs);
lib/metadata/raid_manip.c +468 -22

552 lines not on this page · raw message

lib/metadata/takeover_matrix.h new file +120 -0

120 lines not on this page · raw message

tools/lvconvert.c +5 -2
index f99291a..65143a1 100644
@@ -1845,13 +1845,16 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
 		return lv_raid_change_image_count(lv, image_count, lp->pvh);
 
 	if ((seg_is_linear(seg) || seg_is_striped(seg) || seg_is_mirrored(seg) || lv_is_raid(lv)) &&
-	    ((lp->type_str && lp->type_str[0]) || image_count)) {
+	    (lp->type_str && lp->type_str[0])) {
 		if (segtype_is_any_raid0(lp->segtype) &&
 		    !(lp->target_attr & RAID_FEATURE_RAID0)) {
 			log_error("RAID module does not support RAID0.");
 			return 0;
 		}
-		return lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, image_count, lp->stripes, lp->stripe_size, lp->pvh);
+		if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size, lp->pvh))
+			return_0;
+		log_print_unless_silent("Logical volume %s successfully converted", display_lvname(lv));
+		return 1;
 	}
 
 	if (lp->replace)