From: NeilBrown Date: Mon, 22 Nov 2010 09:58:05 +0000 (+1100) Subject: Assemble: contract next_member loop. X-Git-Tag: mdadm-3.2~287 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1415fe4b6c766caa5a3e57a15cac4a3ac395c543;p=thirdparty%2Fmdadm.git Assemble: contract next_member loop. 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 --- diff --git a/Assemble.c b/Assemble.c index 197ae1ea..b3a214a7 100644 --- a/Assemble.c +++ b/Assemble.c @@ -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); }