diff options
| author | NeilBrown <neilb@suse.de> | 2011-05-11 00:38:02 -0400 |
|---|---|---|
| committer | NeilBrown <neilb@suse.de> | 2011-05-11 00:38:02 -0400 |
| commit | 92f861a72a273ed038c1e22ff9775456353e3009 (patch) | |
| tree | df1ad40ffa987814aafaf0dfe27b8f67285ddd5a | |
| parent | 76073054c95b12af6bd0cc9b9462a265b45ba38f (diff) | |
md/multipath: discard ->working_disks in favour of ->degraded
conf->working_disks duplicates information already available
in mddev->degraded.
So remove working_disks.
Signed-off-by: NeilBrown <neilb@suse.de>
| -rw-r--r-- | drivers/md/multipath.c | 22 | ||||
| -rw-r--r-- | drivers/md/multipath.h | 1 |
2 files changed, 11 insertions, 12 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index c35890990985..02547124aa83 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
| @@ -146,7 +146,7 @@ static void multipath_status (struct seq_file *seq, mddev_t *mddev) | |||
| 146 | int i; | 146 | int i; |
| 147 | 147 | ||
| 148 | seq_printf (seq, " [%d/%d] [", conf->raid_disks, | 148 | seq_printf (seq, " [%d/%d] [", conf->raid_disks, |
| 149 | conf->working_disks); | 149 | conf->raid_disks - mddev->degraded); |
| 150 | for (i = 0; i < conf->raid_disks; i++) | 150 | for (i = 0; i < conf->raid_disks; i++) |
| 151 | seq_printf (seq, "%s", | 151 | seq_printf (seq, "%s", |
| 152 | conf->multipaths[i].rdev && | 152 | conf->multipaths[i].rdev && |
| @@ -187,7 +187,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 187 | { | 187 | { |
| 188 | multipath_conf_t *conf = mddev->private; | 188 | multipath_conf_t *conf = mddev->private; |
| 189 | 189 | ||
| 190 | if (conf->working_disks <= 1) { | 190 | if (conf->raid_disks - mddev->degraded <= 1) { |
| 191 | /* | 191 | /* |
| 192 | * Uh oh, we can do nothing if this is our last path, but | 192 | * Uh oh, we can do nothing if this is our last path, but |
| 193 | * first check if this is a queued request for a device | 193 | * 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) | |||
| 205 | clear_bit(In_sync, &rdev->flags); | 205 | clear_bit(In_sync, &rdev->flags); |
| 206 | set_bit(Faulty, &rdev->flags); | 206 | set_bit(Faulty, &rdev->flags); |
| 207 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 207 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
| 208 | conf->working_disks--; | ||
| 209 | mddev->degraded++; | 208 | mddev->degraded++; |
| 210 | printk(KERN_ALERT "multipath: IO failure on %s," | 209 | printk(KERN_ALERT "multipath: IO failure on %s," |
| 211 | " disabling IO path.\n" | 210 | " disabling IO path.\n" |
| 212 | "multipath: Operation continuing" | 211 | "multipath: Operation continuing" |
| 213 | " on %d IO paths.\n", | 212 | " on %d IO paths.\n", |
| 214 | bdevname (rdev->bdev,b), | 213 | bdevname (rdev->bdev,b), |
| 215 | conf->working_disks); | 214 | conf->raid_disks - mddev->degraded); |
| 216 | } | 215 | } |
| 217 | } | 216 | } |
| 218 | } | 217 | } |
| @@ -227,7 +226,7 @@ static void print_multipath_conf (multipath_conf_t *conf) | |||
| 227 | printk("(conf==NULL)\n"); | 226 | printk("(conf==NULL)\n"); |
| 228 | return; | 227 | return; |
| 229 | } | 228 | } |
| 230 | printk(" --- wd:%d rd:%d\n", conf->working_disks, | 229 | printk(" --- wd:%d rd:%d\n", conf->raid_disks - conf->mddev->degraded, |
| 231 | conf->raid_disks); | 230 | conf->raid_disks); |
| 232 | 231 | ||
| 233 | for (i = 0; i < conf->raid_disks; i++) { | 232 | for (i = 0; i < conf->raid_disks; i++) { |
| @@ -274,7 +273,6 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 274 | PAGE_CACHE_SIZE - 1); | 273 | PAGE_CACHE_SIZE - 1); |
| 275 | } | 274 | } |
| 276 | 275 | ||
| 277 | conf->working_disks++; | ||
| 278 | mddev->degraded--; | 276 | mddev->degraded--; |
| 279 | rdev->raid_disk = path; | 277 | rdev->raid_disk = path; |
| 280 | set_bit(In_sync, &rdev->flags); | 278 | set_bit(In_sync, &rdev->flags); |
| @@ -391,6 +389,7 @@ static int multipath_run (mddev_t *mddev) | |||
| 391 | int disk_idx; | 389 | int disk_idx; |
| 392 | struct multipath_info *disk; | 390 | struct multipath_info *disk; |
| 393 | mdk_rdev_t *rdev; | 391 | mdk_rdev_t *rdev; |
| 392 | int working_disks; | ||
| 394 | 393 | ||
| 395 | if (md_check_no_bitmap(mddev)) | 394 | if (md_check_no_bitmap(mddev)) |
| 396 | return -EINVAL; | 395 | return -EINVAL; |
| @@ -424,7 +423,7 @@ static int multipath_run (mddev_t *mddev) | |||
| 424 | goto out_free_conf; | 423 | goto out_free_conf; |
| 425 | } | 424 | } |
| 426 | 425 | ||
| 427 | conf->working_disks = 0; | 426 | working_disks = 0; |
| 428 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 427 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
| 429 | disk_idx = rdev->raid_disk; | 428 | disk_idx = rdev->raid_disk; |
| 430 | if (disk_idx < 0 || | 429 | if (disk_idx < 0 || |
| @@ -446,7 +445,7 @@ static int multipath_run (mddev_t *mddev) | |||
| 446 | } | 445 | } |
| 447 | 446 | ||
| 448 | if (!test_bit(Faulty, &rdev->flags)) | 447 | if (!test_bit(Faulty, &rdev->flags)) |
| 449 | conf->working_disks++; | 448 | working_disks++; |
| 450 | } | 449 | } |
| 451 | 450 | ||
| 452 | conf->raid_disks = mddev->raid_disks; | 451 | conf->raid_disks = mddev->raid_disks; |
| @@ -454,12 +453,12 @@ static int multipath_run (mddev_t *mddev) | |||
| 454 | spin_lock_init(&conf->device_lock); | 453 | spin_lock_init(&conf->device_lock); |
| 455 | INIT_LIST_HEAD(&conf->retry_list); | 454 | INIT_LIST_HEAD(&conf->retry_list); |
| 456 | 455 | ||
| 457 | if (!conf->working_disks) { | 456 | if (!working_disks) { |
| 458 | printk(KERN_ERR "multipath: no operational IO paths for %s\n", | 457 | printk(KERN_ERR "multipath: no operational IO paths for %s\n", |
| 459 | mdname(mddev)); | 458 | mdname(mddev)); |
| 460 | goto out_free_conf; | 459 | goto out_free_conf; |
| 461 | } | 460 | } |
| 462 | mddev->degraded = conf->raid_disks - conf->working_disks; | 461 | mddev->degraded = conf->raid_disks - working_disks; |
| 463 | 462 | ||
| 464 | conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS, | 463 | conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS, |
| 465 | sizeof(struct multipath_bh)); | 464 | sizeof(struct multipath_bh)); |
| @@ -481,7 +480,8 @@ static int multipath_run (mddev_t *mddev) | |||
| 481 | 480 | ||
| 482 | printk(KERN_INFO | 481 | printk(KERN_INFO |
| 483 | "multipath: array %s active with %d out of %d IO paths\n", | 482 | "multipath: array %s active with %d out of %d IO paths\n", |
| 484 | mdname(mddev), conf->working_disks, mddev->raid_disks); | 483 | mdname(mddev), conf->raid_disks - mddev->degraded, |
| 484 | mddev->raid_disks); | ||
| 485 | /* | 485 | /* |
| 486 | * Ok, everything is just fine now | 486 | * Ok, everything is just fine now |
| 487 | */ | 487 | */ |
diff --git a/drivers/md/multipath.h b/drivers/md/multipath.h index d1c2a8d78395..3c5a45eb5f8a 100644 --- a/drivers/md/multipath.h +++ b/drivers/md/multipath.h | |||
| @@ -9,7 +9,6 @@ struct multipath_private_data { | |||
| 9 | mddev_t *mddev; | 9 | mddev_t *mddev; |
| 10 | struct multipath_info *multipaths; | 10 | struct multipath_info *multipaths; |
| 11 | int raid_disks; | 11 | int raid_disks; |
| 12 | int working_disks; | ||
| 13 | spinlock_t device_lock; | 12 | spinlock_t device_lock; |
| 14 | struct list_head retry_list; | 13 | struct list_head retry_list; |
| 15 | 14 | ||
