]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: contract next_member loop.
authorNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:05 +0000 (20:58 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:05 +0000 (20:58 +1100)
We have a 'goto next_member' loop which is rather spread-out and
confusing.
Recent refactoring make it possible to contract that loop
significantly.

Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c

index 197ae1ea2f5a8a912f3a47160823d4882b7899f5..b3a214a7e0dbb5311f626b653ddeae31a1c9885d 100644 (file)
@@ -390,11 +390,12 @@ int Assemble(struct supertype *st, char *mddev,
                        if (verbose > 0)
                                fprintf(stderr, Name ": looking in container %s\n",
                                        devname);
+
+                       tmpdev->content = tst->ss->container_content(tst, NULL);
                next_member:
                        if (tmpdev->content)
                                content = tmpdev->content;
-                       else
-                               content = tst->ss->container_content(tst, NULL);
+
                        if (!content)
                                goto loop; /* empty container */
 
@@ -405,7 +406,7 @@ int Assemble(struct supertype *st, char *mddev,
                        if (!ident_matches(ident, content, tst,
                                           homehost, update,
                                           report_missmatch ? devname : NULL))
-                               goto loop;
+                               goto next_member;
 
                        /* we have the one container we need, don't keep
                         * looking.  If the chosen member is active, skip.
@@ -521,8 +522,6 @@ int Assemble(struct supertype *st, char *mddev,
        loop:
                dev_policy_free(pol);
                pol = NULL;
-               if (tmpdev->content)
-                       goto next_member;
                if (tst)
                        tst->ss->free_super(tst);
        }