]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Remove re_add flag in favour of new disposition.
authorNeilBrown <neilb@suse.de>
Mon, 9 Jul 2012 07:14:16 +0000 (17:14 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 9 Jul 2012 07:14:16 +0000 (17:14 +1000)
Instead of
   disposition == 'a'  re_add == 1
use
   disposition == 'A'

to record that a re-add was requested.

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

index a94d5fa5eb3b29d78061736eb5325d149434c73a..833eac7ee05c65bb099af5324c7d521648652f9b 100644 (file)
@@ -950,7 +950,6 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
                        char devname[20];
                        devlist.next = NULL;
                        devlist.used = 0;
-                       devlist.re_add = 0;
                        devlist.writemostly = 0;
                        devlist.devname = devname;
                        sprintf(devname, "%d:%d", major(stb.st_rdev),
index a7d6a1e849a262faed536d3801e8ba6a70a46f7c..a596363ce4a4122e6e8445a32dedfb84f118b79a 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -524,7 +524,7 @@ int Manage_subdevs(char *devname, int fd,
                        if (next != dv)
                                continue;
                } else if (strcmp(dv->devname, "missing") == 0) {
-                       if (dv->disposition != 'a' || dv->re_add == 0) {
+                       if (dv->disposition != 'A') {
                                pr_err("'missing' only meaningful "
                                        "with --re-add\n");
                                goto abort;
@@ -610,6 +610,7 @@ int Manage_subdevs(char *devname, int fd,
                                dv->devname, dv->disposition);
                        goto abort;
                case 'a':
+               case 'A':
                        /* add the device */
                        if (subarray) {
                                pr_err("Cannot add disks to a"
@@ -724,8 +725,7 @@ int Manage_subdevs(char *devname, int fd,
                                        break;
                                }
                                /* FIXME this is a bad test to be using */
-                               if (!tst->sb &&
-                                   dv->re_add) {
+                               if (!tst->sb && dv->disposition == 'A') {
                                        /* we are re-adding a device to a
                                         * completely dead array - have to depend
                                         * on kernel to check
@@ -857,7 +857,7 @@ int Manage_subdevs(char *devname, int fd,
                                        }
                                        continue;
                                }
-                               if (dv->re_add) {
+                               if (dv->disposition == 'A') {
                                        if (tfd >= 0)
                                                close(tfd);
                                        pr_err("--re-add for %s to %s is not possible\n",
@@ -943,7 +943,7 @@ int Manage_subdevs(char *devname, int fd,
                                        close(dfd);
                                        goto abort;
                                }
-                       } else if (dv->re_add) {
+                       } else if (dv->disposition == 'A') {
                                /*  this had better be raid1.
                                 * As we are "--re-add"ing we must find a spare slot
                                 * to fill.
@@ -1269,7 +1269,6 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid)
 
        devlist.next = NULL;
        devlist.used = 0;
-       devlist.re_add = 0;
        devlist.writemostly = 0;
        devlist.devname = devname;
        sprintf(devname, "%d:%d", major(devid), minor(devid));
diff --git a/mdadm.c b/mdadm.c
index fa3da9fda7756e19d76ad6fd842060d662e905ee..1ab8267a543e508055b7eea78282ccc88c13aae7 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -117,7 +117,6 @@ int main(int argc, char *argv[])
        int spare_sharing = 1;
        struct supertype *ss = NULL;
        int writemostly = 0;
-       int re_add = 0;
        char *shortopt = short_options;
        int dosyslog = 0;
        int rebuild_map = 0;
@@ -326,7 +325,6 @@ int main(int argc, char *argv[])
                                        dv->devname = optarg;
                                        dv->disposition = devmode;
                                        dv->writemostly = writemostly;
-                                       dv->re_add = re_add;
                                        dv->used = 0;
                                        dv->next = NULL;
                                        *devlistend = dv;
@@ -382,7 +380,6 @@ int main(int argc, char *argv[])
                        dv->devname = optarg;
                        dv->disposition = devmode;
                        dv->writemostly = writemostly;
-                       dv->re_add = re_add;
                        dv->used = 0;
                        dv->next = NULL;
                        *devlistend = dv;
@@ -785,7 +782,7 @@ int main(int argc, char *argv[])
 
                case O(MANAGE,'U'):
                        /* update=devicesize is allowed with --re-add */
-                       if (devmode != 'a' || re_add != 1) {
+                       if (devmode != 'A') {
                                pr_err("--update in Manage mode only"
                                        " allowed with --re-add.\n");
                                exit(1);
@@ -912,11 +909,9 @@ int main(int argc, char *argv[])
                case O(MANAGE,'a'):
                case O(MANAGE,Add): /* add a drive */
                        devmode = 'a';
-                       re_add = 0;
                        continue;
                case O(MANAGE,ReAdd):
-                       devmode = 'a';
-                       re_add = 1;
+                       devmode = 'A';
                        continue;
                case O(MANAGE,'r'): /* remove a drive */
                case O(MANAGE,Remove):
diff --git a/mdadm.h b/mdadm.h
index e92b76869f38c307e9e1ca8692c58570c82bc00f..ff44312100ffd2a94dec26d406c644fed25316c5 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -377,11 +377,11 @@ struct mddev_ident {
 /* List of device names - wildcards expanded */
 struct mddev_dev {
        char *devname;
-       int disposition;        /* 'a' for add, 'r' for remove, 'f' for fail.
+       int disposition;        /* 'a' for add, 'r' for remove, 'f' for fail,
+                                * 'A' for re_add.
                                 * Not set for names read from .config
                                 */
        char writemostly;       /* 1 for 'set writemostly', 2 for 'clear writemostly' */
-       char re_add;
        char used;              /* set when used */
        struct mddev_dev *next;
 };