Skip to contentSkip to conversation

dm raid: avoid WARN_ON() in raid10_md_layout_to_format()

PATCH New [email protected] 1 participant 1 message Jul 13, 2017 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm raid: avoid WARN_ON() in raid10_md_layout_to_format()

From: Heinz Mauelshagen <[email protected]>

---
 drivers/md/dm-raid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm-raid.c +3 -2
index 2e10c2f..b409015 100644
@@ -564,9 +564,10 @@ static const char *raid10_md_layout_to_format(int layout)
 	if (__raid10_near_copies(layout) > 1)
 		return "near";
 
-	WARN_ON(__raid10_far_copies(layout) < 2);
+	if (__raid10_far_copies(layout) > 1)
+		return "far";
 
-	return "far";
+	return "unknown";
 }
 
 /* Return md raid10 algorithm for @name */
Signature · 1 line
2.9.4