]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Remove content from mddev_dev
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)
Now that the next_member loop is much smaller it is easy to
just use 'content' rather than stashing it in 'tmpdev->content'.
So we can remove the 'content' field from 'struct mddev_dev'.

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

index b3a214a7e0dbb5311f626b653ddeae31a1c9885d..4b9b4089c1e15308fb130b8c8ca50b40deddd5c3 100644 (file)
@@ -391,22 +391,21 @@ int Assemble(struct supertype *st, char *mddev,
                                fprintf(stderr, Name ": looking in container %s\n",
                                        devname);
 
-                       tmpdev->content = tst->ss->container_content(tst, NULL);
+                       content = tst->ss->container_content(tst, NULL);
                next_member:
-                       if (tmpdev->content)
-                               content = tmpdev->content;
 
                        if (!content)
                                goto loop; /* empty container */
 
-                       tmpdev->content = content->next;
-                       if (tmpdev->content == NULL)
+                       if (content->next == NULL)
                                tmpdev->used = 2;
 
                        if (!ident_matches(ident, content, tst,
                                           homehost, update,
-                                          report_missmatch ? devname : NULL))
+                                          report_missmatch ? devname : NULL)) {
+                               content = content->next;
                                goto next_member;
+                       }
 
                        /* we have the one container we need, don't keep
                         * looking.  If the chosen member is active, skip.
@@ -417,11 +416,11 @@ int Assemble(struct supertype *st, char *mddev,
                                                content->text_version,
                                                devname);
                        skip:
-                               if (tmpdev->content)
+                               content = content->next;
+                               if (content)
                                        goto next_member;
                                tst->ss->free_super(tst);
                                tst = NULL;
-                               content = NULL;
                                if (auto_assem)
                                        goto loop;
                                dev_policy_free(pol);
index f4d46ff41d53068dca6323c709c98f4c56fcb350..1f78c689ba5d4407d4331967c9cdb90ae86d8519 100644 (file)
--- a/config.c
+++ b/config.c
@@ -260,7 +260,6 @@ struct mddev_dev *load_partitions(void)
                d->devname = strdup(name);
                d->next = rv;
                d->used = 0;
-               d->content = NULL;
                rv = d;
        }
        fclose(f);
@@ -290,7 +289,6 @@ struct mddev_dev *load_containers(void)
                        }
                        d->next = rv;
                        d->used = 0;
-                       d->content = NULL;
                        rv = d;
                }
        free_mdstat(mdstat);
@@ -964,7 +962,6 @@ struct mddev_dev *conf_get_devs()
                        t->devname = strdup(globbuf.gl_pathv[i]);
                        t->next = dlist;
                        t->used = 0;
-                       t->content = NULL;
                        dlist = t;
 /*     printf("one dev is %s\n", t->devname);*/
                }
diff --git a/mdadm.c b/mdadm.c
index efb2e67b4d27999fd8a45fe873fcaa460cf72187..4a8547486c36fa35108ec5d2ae004683eb4f3c25 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -265,7 +265,6 @@ int main(int argc, char *argv[])
                                        dv->writemostly = writemostly;
                                        dv->re_add = re_add;
                                        dv->used = 0;
-                                       dv->content = NULL;
                                        dv->next = NULL;
                                        *devlistend = dv;
                                        devlistend = &dv->next;
@@ -320,7 +319,6 @@ int main(int argc, char *argv[])
                        dv->writemostly = writemostly;
                        dv->re_add = re_add;
                        dv->used = 0;
-                       dv->content = NULL;
                        dv->next = NULL;
                        *devlistend = dv;
                        devlistend = &dv->next;
diff --git a/mdadm.h b/mdadm.h
index 614dc69029ad42bdf6de9784969545e84c99ca85..6d1169b1002fbdb2bb02e52636d3f0c642abb175 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -337,8 +337,6 @@ struct mddev_dev {
        char writemostly;       /* 1 for 'set writemostly', 2 for 'clear writemostly' */
        char re_add;
        char used;              /* set when used */
-       struct mdinfo *content; /* If devname is a container, this might list
-                                * the remaining member arrays. */
        struct mddev_dev *next;
 };