aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-03 04:15:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:17 -0400
commit02c2de8cc835885bdff51a8bfd6c0b659b969f50 (patch)
tree3c3b3adf01e4ec4139888d681eca5becb3374fda /drivers/md/raid5.c
parent850b2b420cd5b363ed4cf48a8816d656c8b5251b (diff)
[PATCH] md: remove the working_disks and failed_disks from raid5 state data.
They are not needed. conf->failed_disks is the same as mddev->degraded and conf->working_disks is conf->raid_disks - mddev->degraded. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index d5a06b258427..1c8ab340a11d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -698,9 +698,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
698 if (!test_bit(Faulty, &rdev->flags)) { 698 if (!test_bit(Faulty, &rdev->flags)) {
699 set_bit(MD_CHANGE_DEVS, &mddev->flags); 699 set_bit(MD_CHANGE_DEVS, &mddev->flags);
700 if (test_bit(In_sync, &rdev->flags)) { 700 if (test_bit(In_sync, &rdev->flags)) {
701 conf->working_disks--;
702 mddev->degraded++; 701 mddev->degraded++;
703 conf->failed_disks++;
704 clear_bit(In_sync, &rdev->flags); 702 clear_bit(In_sync, &rdev->flags);
705 /* 703 /*
706 * if recovery was running, make sure it aborts. 704 * if recovery was running, make sure it aborts.
@@ -711,7 +709,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
711 printk (KERN_ALERT 709 printk (KERN_ALERT
712 "raid5: Disk failure on %s, disabling device." 710 "raid5: Disk failure on %s, disabling device."
713 " Operation continuing on %d devices\n", 711 " Operation continuing on %d devices\n",
714 bdevname(rdev->bdev,b), conf->working_disks); 712 bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded);
715 } 713 }
716} 714}
717 715
@@ -3074,6 +3072,7 @@ static int run(mddev_t *mddev)
3074 mdk_rdev_t *rdev; 3072 mdk_rdev_t *rdev;
3075 struct disk_info *disk; 3073 struct disk_info *disk;
3076 struct list_head *tmp; 3074 struct list_head *tmp;
3075 int working_disks = 0;
3077 3076
3078 if (mddev->level != 5 && mddev->level != 4 && mddev->level != 6) { 3077 if (mddev->level != 5 && mddev->level != 4 && mddev->level != 6) {
3079 printk(KERN_ERR "raid5: %s: raid level not set to 4/5/6 (%d)\n", 3078 printk(KERN_ERR "raid5: %s: raid level not set to 4/5/6 (%d)\n",
@@ -3176,14 +3175,14 @@ static int run(mddev_t *mddev)
3176 printk(KERN_INFO "raid5: device %s operational as raid" 3175 printk(KERN_INFO "raid5: device %s operational as raid"
3177 " disk %d\n", bdevname(rdev->bdev,b), 3176 " disk %d\n", bdevname(rdev->bdev,b),
3178 raid_disk); 3177 raid_disk);
3179 conf->working_disks++; 3178 working_disks++;
3180 } 3179 }
3181 } 3180 }
3182 3181
3183 /* 3182 /*
3184 * 0 for a fully functional array, 1 or 2 for a degraded array. 3183 * 0 for a fully functional array, 1 or 2 for a degraded array.
3185 */ 3184 */
3186 mddev->degraded = conf->failed_disks = conf->raid_disks - conf->working_disks; 3185 mddev->degraded = conf->raid_disks - working_disks;
3187 conf->mddev = mddev; 3186 conf->mddev = mddev;
3188 conf->chunk_size = mddev->chunk_size; 3187 conf->chunk_size = mddev->chunk_size;
3189 conf->level = mddev->level; 3188 conf->level = mddev->level;
@@ -3218,7 +3217,7 @@ static int run(mddev_t *mddev)
3218 if (mddev->degraded > conf->max_degraded) { 3217 if (mddev->degraded > conf->max_degraded) {
3219 printk(KERN_ERR "raid5: not enough operational devices for %s" 3218 printk(KERN_ERR "raid5: not enough operational devices for %s"
3220 " (%d/%d failed)\n", 3219 " (%d/%d failed)\n",
3221 mdname(mddev), conf->failed_disks, conf->raid_disks); 3220 mdname(mddev), mddev->degraded, conf->raid_disks);
3222 goto abort; 3221 goto abort;
3223 } 3222 }
3224 3223
@@ -3375,7 +3374,7 @@ static void status (struct seq_file *seq, mddev_t *mddev)
3375 int i; 3374 int i;
3376 3375
3377 seq_printf (seq, " level %d, %dk chunk, algorithm %d", mddev->level, mddev->chunk_size >> 10, mddev->layout); 3376 seq_printf (seq, " level %d, %dk chunk, algorithm %d", mddev->level, mddev->chunk_size >> 10, mddev->layout);
3378 seq_printf (seq, " [%d/%d] [", conf->raid_disks, conf->working_disks); 3377 seq_printf (seq, " [%d/%d] [", conf->raid_disks, conf->raid_disks - mddev->degraded);
3379 for (i = 0; i < conf->raid_disks; i++) 3378 for (i = 0; i < conf->raid_disks; i++)
3380 seq_printf (seq, "%s", 3379 seq_printf (seq, "%s",
3381 conf->disks[i].rdev && 3380 conf->disks[i].rdev &&
@@ -3397,8 +3396,8 @@ static void print_raid5_conf (raid5_conf_t *conf)
3397 printk("(conf==NULL)\n"); 3396 printk("(conf==NULL)\n");
3398 return; 3397 return;
3399 } 3398 }
3400 printk(" --- rd:%d wd:%d fd:%d\n", conf->raid_disks, 3399 printk(" --- rd:%d wd:%d\n", conf->raid_disks,
3401 conf->working_disks, conf->failed_disks); 3400 conf->raid_disks - conf->mddev->degraded);
3402 3401
3403 for (i = 0; i < conf->raid_disks; i++) { 3402 for (i = 0; i < conf->raid_disks; i++) {
3404 char b[BDEVNAME_SIZE]; 3403 char b[BDEVNAME_SIZE];
@@ -3422,8 +3421,6 @@ static int raid5_spare_active(mddev_t *mddev)
3422 && !test_bit(Faulty, &tmp->rdev->flags) 3421 && !test_bit(Faulty, &tmp->rdev->flags)
3423 && !test_bit(In_sync, &tmp->rdev->flags)) { 3422 && !test_bit(In_sync, &tmp->rdev->flags)) {
3424 mddev->degraded--; 3423 mddev->degraded--;
3425 conf->failed_disks--;
3426 conf->working_disks++;
3427 set_bit(In_sync, &tmp->rdev->flags); 3424 set_bit(In_sync, &tmp->rdev->flags);
3428 } 3425 }
3429 } 3426 }
@@ -3593,7 +3590,6 @@ static int raid5_start_reshape(mddev_t *mddev)
3593 if (raid5_add_disk(mddev, rdev)) { 3590 if (raid5_add_disk(mddev, rdev)) {
3594 char nm[20]; 3591 char nm[20];
3595 set_bit(In_sync, &rdev->flags); 3592 set_bit(In_sync, &rdev->flags);
3596 conf->working_disks++;
3597 added_devices++; 3593 added_devices++;
3598 rdev->recovery_offset = 0; 3594 rdev->recovery_offset = 0;
3599 sprintf(nm, "rd%d", rdev->raid_disk); 3595 sprintf(nm, "rd%d", rdev->raid_disk);