Skip to contentSkip to conversation

2018-06-01-stable - lvconvert: avoid superfluous interim raid type

PATCH Marian Csontos 1 participant 1 message Sep 5, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0e03c686191b036a7cd6e570888793ddbdd5f958
Commit:        0e03c686191b036a7cd6e570888793ddbdd5f958
Parent:        3374a592502ef099d38491b0c2020a6945d825b1
Author:        Heinz Mauelshagen <[email protected]>
AuthorDate:    Fri Aug 31 19:03:52 2018 +0200
Committer:     Marian Csontos <[email protected]>
CommitterDate: Wed Sep 5 16:41:14 2018 +0200

lvconvert: avoid superfluous interim raid type

When converting striped/raid0*/raid6_n_6 <-> raid4, avoid superfluous interim raid5_n layout.

Related: rhbz1447809
(cherry picked from commit 22a13043683a5647e8cc4e3aead911e5269ffd2f)

---
 lib/metadata/raid_manip.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
lib/metadata/raid_manip.c +4 -5
index d3e3a20..3eee77a 100644
@@ -6140,7 +6140,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
 			seg_flag = SEG_RAID6_N_6;
 
 		if (segtype_is_linear(*segtype) ||
-		    (!segtype_is_raid10(*segtype) && !segtype_is_striped(*segtype)))
+		    (!segtype_is_raid4(*segtype) && !segtype_is_raid10(*segtype) && !segtype_is_striped(*segtype)))
 			seg_flag = SEG_RAID5_N;
 
 	/* raid1 -> */
@@ -6209,10 +6209,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
 					  lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count);
 		}
 
-	/* raid4 -> !raid4/raid5* */
-	} else if (seg_is_raid4(seg_from) &&
-		   !segtype_is_raid4(*segtype) && !segtype_is_any_raid5(*segtype)) {
-		seg_flag = SEG_RAID5_N;
+	/* raid4 -> * */
+	} else if (seg_is_raid4(seg_from) && !segtype_is_raid4(*segtype) && !segtype_is_striped(*segtype)) {
+		seg_flag = segtype_is_any_raid6(*segtype) ? SEG_RAID6_N_6 : SEG_RAID5_N;
 
 	/* raid6 -> striped/raid0/raid5/raid10 */
 	} else if (seg_is_any_raid6(seg_from)) {