md/multipath: discard ->working_disks in favour of ->degraded
authorNeilBrown <neilb@suse.de>
Wed, 11 May 2011 04:38:02 +0000 (14:38 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 11 May 2011 04:38:02 +0000 (14:38 +1000)
conf->working_disks duplicates information already available
in mddev->degraded.
So remove working_disks.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/multipath.c
drivers/md/multipath.h

index c35890990985632646483a97e849277023850b1a..02547124aa83bcfccb5cc3f0558912f03e418da9 100644 (file)
@@ -146,7 +146,7 @@ static void multipath_status (struct seq_file *seq, mddev_t *mddev)
        int i;
        
        seq_printf (seq, " [%d/%d] [", conf->raid_disks,
-                                                conf->working_disks);
+                   conf->raid_disks - mddev->degraded);
        for (i = 0; i < conf->raid_disks; i++)
                seq_printf (seq, "%s",
                               conf->multipaths[i].rdev && 
@@ -187,7 +187,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
 {
        multipath_conf_t *conf = mddev->private;
 
-       if (conf->working_disks <= 1) {
+       if (conf->raid_disks - mddev->degraded <= 1) {
                /*
                 * Uh oh, we can do nothing if this is our last path, but
                 * first check if this is a queued request for a device
@@ -205,14 +205,13 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
                        clear_bit(In_sync, &rdev->flags);
                        set_bit(Faulty, &rdev->flags);
                        set_bit(MD_CHANGE_DEVS, &mddev->flags);
-                       conf->working_disks--;
                        mddev->degraded++;
                        printk(KERN_ALERT "multipath: IO failure on %s,"
                                " disabling IO path.\n"
                                "multipath: Operation continuing"
                                " on %d IO paths.\n",
                                bdevname (rdev->bdev,b),
-                               conf->working_disks);
+                               conf->raid_disks - mddev->degraded);
                }
        }
 }
@@ -227,7 +226,7 @@ static void print_multipath_conf (multipath_conf_t *conf)
                printk("(conf==NULL)\n");
                return;
        }
-       printk(" --- wd:%d rd:%d\n", conf->working_disks,
+       printk(" --- wd:%d rd:%d\n", conf->raid_disks - conf->mddev->degraded,
                         conf->raid_disks);
 
        for (i = 0; i < conf->raid_disks; i++) {
@@ -274,7 +273,6 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
                                                           PAGE_CACHE_SIZE - 1);
                        }
 
-                       conf->working_disks++;
                        mddev->degraded--;
                        rdev->raid_disk = path;
                        set_bit(In_sync, &rdev->flags);
@@ -391,6 +389,7 @@ static int multipath_run (mddev_t *mddev)
        int disk_idx;
        struct multipath_info *disk;
        mdk_rdev_t *rdev;
+       int working_disks;
 
        if (md_check_no_bitmap(mddev))
                return -EINVAL;
@@ -424,7 +423,7 @@ static int multipath_run (mddev_t *mddev)
                goto out_free_conf;
        }
 
-       conf->working_disks = 0;
+       working_disks = 0;
        list_for_each_entry(rdev, &mddev->disks, same_set) {
                disk_idx = rdev->raid_disk;
                if (disk_idx < 0 ||
@@ -446,7 +445,7 @@ static int multipath_run (mddev_t *mddev)
                }
 
                if (!test_bit(Faulty, &rdev->flags))
-                       conf->working_disks++;
+                       working_disks++;
        }
 
        conf->raid_disks = mddev->raid_disks;
@@ -454,12 +453,12 @@ static int multipath_run (mddev_t *mddev)
        spin_lock_init(&conf->device_lock);
        INIT_LIST_HEAD(&conf->retry_list);
 
-       if (!conf->working_disks) {
+       if (!working_disks) {
                printk(KERN_ERR "multipath: no operational IO paths for %s\n",
                        mdname(mddev));
                goto out_free_conf;
        }
-       mddev->degraded = conf->raid_disks - conf->working_disks;
+       mddev->degraded = conf->raid_disks - working_disks;
 
        conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS,
                                                 sizeof(struct multipath_bh));
@@ -481,7 +480,8 @@ static int multipath_run (mddev_t *mddev)
 
        printk(KERN_INFO 
                "multipath: array %s active with %d out of %d IO paths\n",
-               mdname(mddev), conf->working_disks, mddev->raid_disks);
+               mdname(mddev), conf->raid_disks - mddev->degraded,
+              mddev->raid_disks);
        /*
         * Ok, everything is just fine now
         */
index d1c2a8d7839553f28e79b04ec2f585ac8634c815..3c5a45eb5f8a14ef8e8caf372470a73ce0dc7700 100644 (file)
@@ -9,7 +9,6 @@ struct multipath_private_data {
        mddev_t                 *mddev;
        struct multipath_info   *multipaths;
        int                     raid_disks;
-       int                     working_disks;
        spinlock_t              device_lock;
        struct list_head        retry_list;