diff options
author | NeilBrown <neilb@suse.de> | 2005-11-09 00:39:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:38 -0500 |
commit | b2d444d7ad975d555bb919601bcdc0e58975a40e (patch) | |
tree | 963a29258af95f05dd28d9de0180ac9ef533aeed /drivers/md/raid5.c | |
parent | ba22dcbf106338a5c46d6979f9b19564faae3d49 (diff) |
[PATCH] md: convert 'faulty' and 'in_sync' fields to bits in 'flags' field
This has the advantage of removing the confusion caused by 'rdev_t' and
'mddev_t' both having 'in_sync' fields.
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.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 77610b98d4e0..d1c488b008af 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -525,19 +525,19 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
525 | raid5_conf_t *conf = (raid5_conf_t *) mddev->private; | 525 | raid5_conf_t *conf = (raid5_conf_t *) mddev->private; |
526 | PRINTK("raid5: error called\n"); | 526 | PRINTK("raid5: error called\n"); |
527 | 527 | ||
528 | if (!rdev->faulty) { | 528 | if (!test_bit(Faulty, &rdev->flags)) { |
529 | mddev->sb_dirty = 1; | 529 | mddev->sb_dirty = 1; |
530 | if (rdev->in_sync) { | 530 | if (test_bit(In_sync, &rdev->flags)) { |
531 | conf->working_disks--; | 531 | conf->working_disks--; |
532 | mddev->degraded++; | 532 | mddev->degraded++; |
533 | conf->failed_disks++; | 533 | conf->failed_disks++; |
534 | rdev->in_sync = 0; | 534 | clear_bit(In_sync, &rdev->flags); |
535 | /* | 535 | /* |
536 | * if recovery was running, make sure it aborts. | 536 | * if recovery was running, make sure it aborts. |
537 | */ | 537 | */ |
538 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 538 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); |
539 | } | 539 | } |
540 | rdev->faulty = 1; | 540 | set_bit(Faulty, &rdev->flags); |
541 | printk (KERN_ALERT | 541 | printk (KERN_ALERT |
542 | "raid5: Disk failure on %s, disabling device." | 542 | "raid5: Disk failure on %s, disabling device." |
543 | " Operation continuing on %d devices\n", | 543 | " Operation continuing on %d devices\n", |
@@ -1003,12 +1003,12 @@ static void handle_stripe(struct stripe_head *sh) | |||
1003 | } | 1003 | } |
1004 | if (dev->written) written++; | 1004 | if (dev->written) written++; |
1005 | rdev = conf->disks[i].rdev; /* FIXME, should I be looking rdev */ | 1005 | rdev = conf->disks[i].rdev; /* FIXME, should I be looking rdev */ |
1006 | if (!rdev || !rdev->in_sync) { | 1006 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { |
1007 | /* The ReadError flag wil just be confusing now */ | 1007 | /* The ReadError flag wil just be confusing now */ |
1008 | clear_bit(R5_ReadError, &dev->flags); | 1008 | clear_bit(R5_ReadError, &dev->flags); |
1009 | clear_bit(R5_ReWrite, &dev->flags); | 1009 | clear_bit(R5_ReWrite, &dev->flags); |
1010 | } | 1010 | } |
1011 | if (!rdev || !rdev->in_sync | 1011 | if (!rdev || !test_bit(In_sync, &rdev->flags) |
1012 | || test_bit(R5_ReadError, &dev->flags)) { | 1012 | || test_bit(R5_ReadError, &dev->flags)) { |
1013 | failed++; | 1013 | failed++; |
1014 | failed_num = i; | 1014 | failed_num = i; |
@@ -1027,7 +1027,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1027 | 1027 | ||
1028 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { | 1028 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { |
1029 | mdk_rdev_t *rdev = conf->disks[i].rdev; | 1029 | mdk_rdev_t *rdev = conf->disks[i].rdev; |
1030 | if (rdev && rdev->in_sync) | 1030 | if (rdev && test_bit(In_sync, &rdev->flags)) |
1031 | /* multiple read failures in one stripe */ | 1031 | /* multiple read failures in one stripe */ |
1032 | md_error(conf->mddev, rdev); | 1032 | md_error(conf->mddev, rdev); |
1033 | } | 1033 | } |
@@ -1384,7 +1384,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1384 | 1384 | ||
1385 | rcu_read_lock(); | 1385 | rcu_read_lock(); |
1386 | rdev = rcu_dereference(conf->disks[i].rdev); | 1386 | rdev = rcu_dereference(conf->disks[i].rdev); |
1387 | if (rdev && rdev->faulty) | 1387 | if (rdev && test_bit(Faulty, &rdev->flags)) |
1388 | rdev = NULL; | 1388 | rdev = NULL; |
1389 | if (rdev) | 1389 | if (rdev) |
1390 | atomic_inc(&rdev->nr_pending); | 1390 | atomic_inc(&rdev->nr_pending); |
@@ -1458,7 +1458,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
1458 | rcu_read_lock(); | 1458 | rcu_read_lock(); |
1459 | for (i=0; i<mddev->raid_disks; i++) { | 1459 | for (i=0; i<mddev->raid_disks; i++) { |
1460 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | 1460 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); |
1461 | if (rdev && !rdev->faulty && atomic_read(&rdev->nr_pending)) { | 1461 | if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { |
1462 | request_queue_t *r_queue = bdev_get_queue(rdev->bdev); | 1462 | request_queue_t *r_queue = bdev_get_queue(rdev->bdev); |
1463 | 1463 | ||
1464 | atomic_inc(&rdev->nr_pending); | 1464 | atomic_inc(&rdev->nr_pending); |
@@ -1503,7 +1503,7 @@ static int raid5_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
1503 | rcu_read_lock(); | 1503 | rcu_read_lock(); |
1504 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | 1504 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { |
1505 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | 1505 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); |
1506 | if (rdev && !rdev->faulty) { | 1506 | if (rdev && !test_bit(Faulty, &rdev->flags)) { |
1507 | struct block_device *bdev = rdev->bdev; | 1507 | struct block_device *bdev = rdev->bdev; |
1508 | request_queue_t *r_queue = bdev_get_queue(bdev); | 1508 | request_queue_t *r_queue = bdev_get_queue(bdev); |
1509 | 1509 | ||
@@ -1850,7 +1850,7 @@ static int run(mddev_t *mddev) | |||
1850 | 1850 | ||
1851 | disk->rdev = rdev; | 1851 | disk->rdev = rdev; |
1852 | 1852 | ||
1853 | if (rdev->in_sync) { | 1853 | if (test_bit(In_sync, &rdev->flags)) { |
1854 | char b[BDEVNAME_SIZE]; | 1854 | char b[BDEVNAME_SIZE]; |
1855 | printk(KERN_INFO "raid5: device %s operational as raid" | 1855 | printk(KERN_INFO "raid5: device %s operational as raid" |
1856 | " disk %d\n", bdevname(rdev->bdev,b), | 1856 | " disk %d\n", bdevname(rdev->bdev,b), |
@@ -2029,7 +2029,7 @@ static void status (struct seq_file *seq, mddev_t *mddev) | |||
2029 | for (i = 0; i < conf->raid_disks; i++) | 2029 | for (i = 0; i < conf->raid_disks; i++) |
2030 | seq_printf (seq, "%s", | 2030 | seq_printf (seq, "%s", |
2031 | conf->disks[i].rdev && | 2031 | conf->disks[i].rdev && |
2032 | conf->disks[i].rdev->in_sync ? "U" : "_"); | 2032 | test_bit(In_sync, &conf->disks[i].rdev->flags) ? "U" : "_"); |
2033 | seq_printf (seq, "]"); | 2033 | seq_printf (seq, "]"); |
2034 | #if RAID5_DEBUG | 2034 | #if RAID5_DEBUG |
2035 | #define D(x) \ | 2035 | #define D(x) \ |
@@ -2056,7 +2056,7 @@ static void print_raid5_conf (raid5_conf_t *conf) | |||
2056 | tmp = conf->disks + i; | 2056 | tmp = conf->disks + i; |
2057 | if (tmp->rdev) | 2057 | if (tmp->rdev) |
2058 | printk(" disk %d, o:%d, dev:%s\n", | 2058 | printk(" disk %d, o:%d, dev:%s\n", |
2059 | i, !tmp->rdev->faulty, | 2059 | i, !test_bit(Faulty, &tmp->rdev->flags), |
2060 | bdevname(tmp->rdev->bdev,b)); | 2060 | bdevname(tmp->rdev->bdev,b)); |
2061 | } | 2061 | } |
2062 | } | 2062 | } |
@@ -2070,12 +2070,12 @@ static int raid5_spare_active(mddev_t *mddev) | |||
2070 | for (i = 0; i < conf->raid_disks; i++) { | 2070 | for (i = 0; i < conf->raid_disks; i++) { |
2071 | tmp = conf->disks + i; | 2071 | tmp = conf->disks + i; |
2072 | if (tmp->rdev | 2072 | if (tmp->rdev |
2073 | && !tmp->rdev->faulty | 2073 | && !test_bit(Faulty, &tmp->rdev->flags) |
2074 | && !tmp->rdev->in_sync) { | 2074 | && !test_bit(In_sync, &tmp->rdev->flags)) { |
2075 | mddev->degraded--; | 2075 | mddev->degraded--; |
2076 | conf->failed_disks--; | 2076 | conf->failed_disks--; |
2077 | conf->working_disks++; | 2077 | conf->working_disks++; |
2078 | tmp->rdev->in_sync = 1; | 2078 | set_bit(In_sync, &tmp->rdev->flags); |
2079 | } | 2079 | } |
2080 | } | 2080 | } |
2081 | print_raid5_conf(conf); | 2081 | print_raid5_conf(conf); |
@@ -2092,7 +2092,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number) | |||
2092 | print_raid5_conf(conf); | 2092 | print_raid5_conf(conf); |
2093 | rdev = p->rdev; | 2093 | rdev = p->rdev; |
2094 | if (rdev) { | 2094 | if (rdev) { |
2095 | if (rdev->in_sync || | 2095 | if (test_bit(In_sync, &rdev->flags) || |
2096 | atomic_read(&rdev->nr_pending)) { | 2096 | atomic_read(&rdev->nr_pending)) { |
2097 | err = -EBUSY; | 2097 | err = -EBUSY; |
2098 | goto abort; | 2098 | goto abort; |
@@ -2127,7 +2127,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
2127 | */ | 2127 | */ |
2128 | for (disk=0; disk < mddev->raid_disks; disk++) | 2128 | for (disk=0; disk < mddev->raid_disks; disk++) |
2129 | if ((p=conf->disks + disk)->rdev == NULL) { | 2129 | if ((p=conf->disks + disk)->rdev == NULL) { |
2130 | rdev->in_sync = 0; | 2130 | clear_bit(In_sync, &rdev->flags); |
2131 | rdev->raid_disk = disk; | 2131 | rdev->raid_disk = disk; |
2132 | found = 1; | 2132 | found = 1; |
2133 | if (rdev->saved_raid_disk != disk) | 2133 | if (rdev->saved_raid_disk != disk) |