Commit 92f861a72a273ed038c1e22ff9775456353e3009

Authored by NeilBrown
1 parent 76073054c9

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>

Showing 2 changed files with 11 additions and 12 deletions Side-by-side Diff

drivers/md/multipath.c
... ... @@ -146,7 +146,7 @@
146 146 int i;
147 147  
148 148 seq_printf (seq, " [%d/%d] [", conf->raid_disks,
149   - conf->working_disks);
  149 + conf->raid_disks - mddev->degraded);
150 150 for (i = 0; i < conf->raid_disks; i++)
151 151 seq_printf (seq, "%s",
152 152 conf->multipaths[i].rdev &&
... ... @@ -187,7 +187,7 @@
187 187 {
188 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 192 * Uh oh, we can do nothing if this is our last path, but
193 193 * first check if this is a queued request for a device
194 194  
... ... @@ -205,14 +205,13 @@
205 205 clear_bit(In_sync, &rdev->flags);
206 206 set_bit(Faulty, &rdev->flags);
207 207 set_bit(MD_CHANGE_DEVS, &mddev->flags);
208   - conf->working_disks--;
209 208 mddev->degraded++;
210 209 printk(KERN_ALERT "multipath: IO failure on %s,"
211 210 " disabling IO path.\n"
212 211 "multipath: Operation continuing"
213 212 " on %d IO paths.\n",
214 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 @@
227 226 printk("(conf==NULL)\n");
228 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 230 conf->raid_disks);
232 231  
233 232 for (i = 0; i < conf->raid_disks; i++) {
... ... @@ -274,7 +273,6 @@
274 273 PAGE_CACHE_SIZE - 1);
275 274 }
276 275  
277   - conf->working_disks++;
278 276 mddev->degraded--;
279 277 rdev->raid_disk = path;
280 278 set_bit(In_sync, &rdev->flags);
... ... @@ -391,6 +389,7 @@
391 389 int disk_idx;
392 390 struct multipath_info *disk;
393 391 mdk_rdev_t *rdev;
  392 + int working_disks;
394 393  
395 394 if (md_check_no_bitmap(mddev))
396 395 return -EINVAL;
... ... @@ -424,7 +423,7 @@
424 423 goto out_free_conf;
425 424 }
426 425  
427   - conf->working_disks = 0;
  426 + working_disks = 0;
428 427 list_for_each_entry(rdev, &mddev->disks, same_set) {
429 428 disk_idx = rdev->raid_disk;
430 429 if (disk_idx < 0 ||
... ... @@ -446,7 +445,7 @@
446 445 }
447 446  
448 447 if (!test_bit(Faulty, &rdev->flags))
449   - conf->working_disks++;
  448 + working_disks++;
450 449 }
451 450  
452 451 conf->raid_disks = mddev->raid_disks;
453 452  
... ... @@ -454,12 +453,12 @@
454 453 spin_lock_init(&conf->device_lock);
455 454 INIT_LIST_HEAD(&conf->retry_list);
456 455  
457   - if (!conf->working_disks) {
  456 + if (!working_disks) {
458 457 printk(KERN_ERR "multipath: no operational IO paths for %s\n",
459 458 mdname(mddev));
460 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 463 conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS,
465 464 sizeof(struct multipath_bh));
... ... @@ -481,7 +480,8 @@
481 480  
482 481 printk(KERN_INFO
483 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 486 * Ok, everything is just fine now
487 487 */
drivers/md/multipath.h
... ... @@ -9,7 +9,6 @@
9 9 mddev_t *mddev;
10 10 struct multipath_info *multipaths;
11 11 int raid_disks;
12   - int working_disks;
13 12 spinlock_t device_lock;
14 13 struct list_head retry_list;
15 14