]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
util/set_array_info: Simplify code since md_get_version returns a constant
authorJes Sorensen <Jes.Sorensen@gmail.com>
Wed, 5 Apr 2017 19:06:24 +0000 (15:06 -0400)
committerJes Sorensen <Jes.Sorensen@gmail.com>
Wed, 5 Apr 2017 19:06:24 +0000 (15:06 -0400)
md_get_version() always returns (0 * 1000) + (90 * 100) + 3, so no
point in calling it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
util.c

diff --git a/util.c b/util.c
index 56daee34c5b76c3195d52beb9064be200040492a..afeb6a5d92d13b06595de2a23d111e392e1c8940 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1858,22 +1858,19 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
         * This varies between externally managed arrays
         * and older kernels
         */
-       int vers = md_get_version(mdfd);
+       mdu_array_info_t inf;
        int rv;
 
 #ifndef MDASSEMBLE
        if (st->ss->external)
-               rv = sysfs_set_array(info, vers);
-       else
+               return sysfs_set_array(info, 9003);
 #endif
-               if ((vers % 100) >= 1) { /* can use different versions */
-               mdu_array_info_t inf;
-               memset(&inf, 0, sizeof(inf));
-               inf.major_version = info->array.major_version;
-               inf.minor_version = info->array.minor_version;
-               rv = md_set_array_info(mdfd, &inf);
-       } else
-               rv = md_set_array_info(mdfd, NULL);
+               
+       memset(&inf, 0, sizeof(inf));
+       inf.major_version = info->array.major_version;
+       inf.minor_version = info->array.minor_version;
+       rv = md_set_array_info(mdfd, &inf);
+
        return rv;
 }