dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/util-set_array_info-Simplify-code-since-md_get-versi.patch

2c1b57
From 700483a22340f2f25a761acd08e6db87e92d90e9 Mon Sep 17 00:00:00 2001
2c1b57
From: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
Date: Wed, 5 Apr 2017 15:06:24 -0400
2c1b57
Subject: [RHEL7.5 PATCH 053/169] util/set_array_info: Simplify code since
2c1b57
 md_get_version returns a constant
2c1b57
2c1b57
md_get_version() always returns (0 * 1000) + (90 * 100) + 3, so no
2c1b57
point in calling it.
2c1b57
2c1b57
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
---
2c1b57
 util.c | 19 ++++++++-----------
2c1b57
 1 file changed, 8 insertions(+), 11 deletions(-)
2c1b57
2c1b57
diff --git a/util.c b/util.c
2c1b57
index 56daee3..afeb6a5 100644
2c1b57
--- a/util.c
2c1b57
+++ b/util.c
2c1b57
@@ -1858,22 +1858,19 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
2c1b57
 	 * This varies between externally managed arrays
2c1b57
 	 * and older kernels
2c1b57
 	 */
2c1b57
-	int vers = md_get_version(mdfd);
2c1b57
+	mdu_array_info_t inf;
2c1b57
 	int rv;
2c1b57
 
2c1b57
 #ifndef MDASSEMBLE
2c1b57
 	if (st->ss->external)
2c1b57
-		rv = sysfs_set_array(info, vers);
2c1b57
-	else
2c1b57
+		return sysfs_set_array(info, 9003);
2c1b57
 #endif
2c1b57
-		if ((vers % 100) >= 1) { /* can use different versions */
2c1b57
-		mdu_array_info_t inf;
2c1b57
-		memset(&inf, 0, sizeof(inf));
2c1b57
-		inf.major_version = info->array.major_version;
2c1b57
-		inf.minor_version = info->array.minor_version;
2c1b57
-		rv = md_set_array_info(mdfd, &inf);
2c1b57
-	} else
2c1b57
-		rv = md_set_array_info(mdfd, NULL);
2c1b57
+		
2c1b57
+	memset(&inf, 0, sizeof(inf));
2c1b57
+	inf.major_version = info->array.major_version;
2c1b57
+	inf.minor_version = info->array.minor_version;
2c1b57
+	rv = md_set_array_info(mdfd, &inf);
2c1b57
+
2c1b57
 	return rv;
2c1b57
 }
2c1b57
 
2c1b57
-- 
2c1b57
2.7.4
2c1b57