]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: turn next_member goto loop into a for loop.
authorNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:06 +0000 (20:58 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:06 +0000 (20:58 +1100)
It becomes much clearer what is happening now.

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

index 771cb77c88ccd5493ec3b094f2bae438be4324c8..dbf78f9420a9ec89b4f5d37d9ae15d4d13e0f503 100644 (file)
@@ -406,29 +406,27 @@ int Assemble(struct supertype *st, char *mddev,
                                fprintf(stderr, Name ": looking in container %s\n",
                                        devname);
 
-                       content = tst->ss->container_content(tst, NULL);
-               next_member:
-
-                       if (!content)
-                               goto loop; /* empty container */
-
-                       if (content->next == NULL)
+                       for (content = tst->ss->container_content(tst, NULL);
+                            content;
+                            content = content->next) {
+
+                               if (!ident_matches(ident, content, tst,
+                                                  homehost, update,
+                                                  report_missmatch ? devname : NULL))
+                                       /* message already printed */;
+                               else if (is_member_busy(content->text_version)) {
+                                       if (report_missmatch)
+                                               fprintf(stderr, Name ": member %s in %s is already assembled\n",
+                                                       content->text_version,
+                                                       devname);
+                               } else
+                                       break;
+                       }
+                       if (!content) {
                                tmpdev->used = 2;
-
-                       if (!ident_matches(ident, content, tst,
-                                          homehost, update,
-                                          report_missmatch ? devname : NULL)) {
-                               content = content->next;
-                               goto next_member;
-                       } else if (is_member_busy(content->text_version)) {
-                               if (report_missmatch)
-                                       fprintf(stderr, Name ": member %s in %s is already assembled\n",
-                                               content->text_version,
-                                               devname);
-
-                               content = content->next;
-                               goto next_member;
+                               goto loop; /* empty container */
                        }
+
                        st = tst; tst = NULL;
                        if (!auto_assem && inargv && tmpdev->next != NULL) {
                                fprintf(stderr, Name ": %s is a container, but is not "