Skip to contentSkip to conversation

master - lvconvert: add segtype raid5_n and conversions to/from it

PATCH Heinz Mauelshagen 1 participant 1 message Feb 3, 2017 MD RAID

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=60ddd05f163cbf53670e5c8deabfc384168eae0f
Commit:        60ddd05f163cbf53670e5c8deabfc384168eae0f
Parent:        875ce04c61fb40436bf4d6308356c800d08c1f7e
Author:        Heinz Mauelshagen <[email protected]>
AuthorDate:    Fri Feb 3 20:39:40 2017 +0100
Committer:     Heinz Mauelshagen <[email protected]>
CommitterDate: Fri Feb 3 20:40:26 2017 +0100

lvconvert: add segtype raid5_n and conversions to/from it

Add:
- support for segment type raid5_n (striped raid with dedicated last parity SubLVs)
- conversion support from striped/raid0/raid0_meta/raid4 to/from raid5_n
- related tests to lvconvert-raid-takeover.sh

Related: rhbz1366296

---
 lib/metadata/merge.c                  |    7 +-
 lib/metadata/raid_manip.c             |  252 +++++++++++++++++++++++----------
 lib/raid/raid.c                       |   15 +-
 libdm/libdm-deptree.c                 |    7 +-
 test/shell/lvconvert-raid-takeover.sh |   63 ++++++++-
 5 files changed, 259 insertions(+), 85 deletions(-)
lib/metadata/merge.c +4 -3
index 59c0885..dbd91db 100644
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -148,7 +148,8 @@ static void _check_raid1_seg(struct lv_segment *seg, int *error_count)
 static void _check_raid45610_seg(struct lv_segment *seg, int *error_count)
 {
 	/* Checks applying to any raid4/5/6/10 */
-	if (!seg->meta_areas)
+	/* Allow raid4 + raid5_n to get activated w/o metadata (mandatory during conversion between them) */
+	if (!(seg_is_raid4(seg) || seg_is_raid5_n(seg)) && !seg->meta_areas)
 		raid_seg_error("no meta areas");
 	if (!seg->stripe_size)
 		raid_seg_error("zero stripe size");
@@ -610,7 +611,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
 				continue;
 			if (lv == seg_lv(seg, s))
 				seg_found++;
-			if (seg_is_raid_with_meta(seg) && (lv == seg_metalv(seg, s)))
+			if (seg->meta_areas && seg_is_raid_with_meta(seg) && (lv == seg_metalv(seg, s)))
 				seg_found++;
 		}
 		if (seg_is_replicator_dev(seg)) {
lib/metadata/raid_manip.c +179 -73

451 lines not on this page · raw message

lib/raid/raid.c +8 -7
index 1e562ff..7dfafef 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2016 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2017 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -87,13 +87,13 @@ static int _raid_text_import_areas(struct lv_segment *seg,
 		}
 
 		/* Metadata device comes first. */
-		if (!seg_is_raid0(seg)) {
-			if (!(lv = find_lv(seg->lv->vg, cv->v.str))) {
-				log_error("Couldn't find volume '%s' for segment '%s'.",
-					  cv->v.str ? : "NULL", seg_name);
-				return 0;
-			}
+		if (!(lv = find_lv(seg->lv->vg, cv->v.str))) {
+			log_error("Couldn't find volume '%s' for segment '%s'.",
+				  cv->v.str ? : "NULL", seg_name);
+			return 0;
+		}
 
+		if (strstr(lv->name, "_rmeta_")) {
 			if (!set_lv_segment_area_lv(seg, s, lv, 0, RAID_META))
 				return_0;
 			cv = cv->next;
@@ -537,6 +537,7 @@ static const struct raid_type {
 	{ SEG_TYPE_NAME_RAID10,     0, SEG_RAID10 | SEG_AREAS_MIRRORED },
 	{ SEG_TYPE_NAME_RAID4,      1, SEG_RAID4 },
 	{ SEG_TYPE_NAME_RAID5,      1, SEG_RAID5 },
+	{ SEG_TYPE_NAME_RAID5_N,    1, SEG_RAID5_N },
 	{ SEG_TYPE_NAME_RAID5_LA,   1, SEG_RAID5_LA },
 	{ SEG_TYPE_NAME_RAID5_LS,   1, SEG_RAID5_LS },
 	{ SEG_TYPE_NAME_RAID5_RA,   1, SEG_RAID5_RA },
libdm/libdm-deptree.c +6 -1
index c5226a7..8a32320 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2016 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Red Hat, Inc. All rights reserved.
  *
  * This file is part of the device-mapper userspace tools.
  *
@@ -47,6 +47,7 @@ enum {
 	SEG_RAID1,
 	SEG_RAID10,
 	SEG_RAID4,
+	SEG_RAID5_N,
 	SEG_RAID5_LA,
 	SEG_RAID5_RA,
 	SEG_RAID5_LS,
@@ -81,6 +82,7 @@ static const struct {
 	{ SEG_RAID1, "raid1"},
 	{ SEG_RAID10, "raid10"},
 	{ SEG_RAID4, "raid4"},
+	{ SEG_RAID5_N,  "raid5_n"},
 	{ SEG_RAID5_LA, "raid5_la"},
 	{ SEG_RAID5_RA, "raid5_ra"},
 	{ SEG_RAID5_LS, "raid5_ls"},
@@ -2140,6 +2142,7 @@ static int _emit_areas_line(struct dm_task *dmt __attribute__((unused)),
 		case SEG_RAID1:
 		case SEG_RAID10:
 		case SEG_RAID4:
+		case SEG_RAID5_N:
 		case SEG_RAID5_LA:
 		case SEG_RAID5_RA:
 		case SEG_RAID5_LS:
@@ -2588,6 +2591,7 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 	case SEG_RAID1:
 	case SEG_RAID10:
 	case SEG_RAID4:
+	case SEG_RAID5_N:
 	case SEG_RAID5_LA:
 	case SEG_RAID5_RA:
 	case SEG_RAID5_LS:
@@ -3869,6 +3873,7 @@ int dm_tree_node_add_null_area(struct dm_tree_node *node, uint64_t offset)
 	case SEG_RAID0_META:
 	case SEG_RAID1:
 	case SEG_RAID4:
+	case SEG_RAID5_N:
 	case SEG_RAID5_LA:
 	case SEG_RAID5_RA:
 	case SEG_RAID5_LS:
test/shell/lvconvert-raid-takeover.sh +62 -1

85 lines not on this page · raw message