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/raid6main.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/raid6main.c')
-rw-r--r-- | drivers/md/raid6main.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index 84f3ee01e4c8..eae5a35629c5 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -507,19 +507,19 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
507 | raid6_conf_t *conf = (raid6_conf_t *) mddev->private; | 507 | raid6_conf_t *conf = (raid6_conf_t *) mddev->private; |
508 | PRINTK("raid6: error called\n"); | 508 | PRINTK("raid6: error called\n"); |
509 | 509 | ||
510 | if (!rdev->faulty) { | 510 | if (!test_bit(Faulty, &rdev->flags)) { |
511 | mddev->sb_dirty = 1; | 511 | mddev->sb_dirty = 1; |
512 | if (rdev->in_sync) { | 512 | if (test_bit(In_sync, &rdev->flags)) { |
513 | conf->working_disks--; | 513 | conf->working_disks--; |
514 | mddev->degraded++; | 514 | mddev->degraded++; |
515 | conf->failed_disks++; | 515 | conf->failed_disks++; |
516 | rdev->in_sync = 0; | 516 | clear_bit(In_sync, &rdev->flags); |
517 | /* | 517 | /* |
518 | * if recovery was running, make sure it aborts. | 518 | * if recovery was running, make sure it aborts. |
519 | */ | 519 | */ |
520 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 520 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); |
521 | } | 521 | } |
522 | rdev->faulty = 1; | 522 | set_bit(Faulty, &rdev->flags); |
523 | printk (KERN_ALERT | 523 | printk (KERN_ALERT |
524 | "raid6: Disk failure on %s, disabling device." | 524 | "raid6: Disk failure on %s, disabling device." |
525 | " Operation continuing on %d devices\n", | 525 | " Operation continuing on %d devices\n", |
@@ -1071,7 +1071,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1071 | } | 1071 | } |
1072 | if (dev->written) written++; | 1072 | if (dev->written) written++; |
1073 | rdev = conf->disks[i].rdev; /* FIXME, should I be looking rdev */ | 1073 | rdev = conf->disks[i].rdev; /* FIXME, should I be looking rdev */ |
1074 | if (!rdev || !rdev->in_sync) { | 1074 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { |
1075 | if ( failed < 2 ) | 1075 | if ( failed < 2 ) |
1076 | failed_num[failed] = i; | 1076 | failed_num[failed] = i; |
1077 | failed++; | 1077 | failed++; |
@@ -1465,7 +1465,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1465 | 1465 | ||
1466 | rcu_read_lock(); | 1466 | rcu_read_lock(); |
1467 | rdev = rcu_dereference(conf->disks[i].rdev); | 1467 | rdev = rcu_dereference(conf->disks[i].rdev); |
1468 | if (rdev && rdev->faulty) | 1468 | if (rdev && test_bit(Faulty, &rdev->flags)) |
1469 | rdev = NULL; | 1469 | rdev = NULL; |
1470 | if (rdev) | 1470 | if (rdev) |
1471 | atomic_inc(&rdev->nr_pending); | 1471 | atomic_inc(&rdev->nr_pending); |
@@ -1539,7 +1539,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
1539 | rcu_read_lock(); | 1539 | rcu_read_lock(); |
1540 | for (i=0; i<mddev->raid_disks; i++) { | 1540 | for (i=0; i<mddev->raid_disks; i++) { |
1541 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | 1541 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); |
1542 | if (rdev && !rdev->faulty && atomic_read(&rdev->nr_pending)) { | 1542 | if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { |
1543 | request_queue_t *r_queue = bdev_get_queue(rdev->bdev); | 1543 | request_queue_t *r_queue = bdev_get_queue(rdev->bdev); |
1544 | 1544 | ||
1545 | atomic_inc(&rdev->nr_pending); | 1545 | atomic_inc(&rdev->nr_pending); |
@@ -1584,7 +1584,7 @@ static int raid6_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
1584 | rcu_read_lock(); | 1584 | rcu_read_lock(); |
1585 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | 1585 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { |
1586 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | 1586 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); |
1587 | if (rdev && !rdev->faulty) { | 1587 | if (rdev && !test_bit(Faulty, &rdev->flags)) { |
1588 | struct block_device *bdev = rdev->bdev; | 1588 | struct block_device *bdev = rdev->bdev; |
1589 | request_queue_t *r_queue = bdev_get_queue(bdev); | 1589 | request_queue_t *r_queue = bdev_get_queue(bdev); |
1590 | 1590 | ||
@@ -1868,7 +1868,7 @@ static int run(mddev_t *mddev) | |||
1868 | 1868 | ||
1869 | disk->rdev = rdev; | 1869 | disk->rdev = rdev; |
1870 | 1870 | ||
1871 | if (rdev->in_sync) { | 1871 | if (test_bit(In_sync, &rdev->flags)) { |
1872 | char b[BDEVNAME_SIZE]; | 1872 | char b[BDEVNAME_SIZE]; |
1873 | printk(KERN_INFO "raid6: device %s operational as raid" | 1873 | printk(KERN_INFO "raid6: device %s operational as raid" |
1874 | " disk %d\n", bdevname(rdev->bdev,b), | 1874 | " disk %d\n", bdevname(rdev->bdev,b), |
@@ -2052,7 +2052,7 @@ static void status (struct seq_file *seq, mddev_t *mddev) | |||
2052 | for (i = 0; i < conf->raid_disks; i++) | 2052 | for (i = 0; i < conf->raid_disks; i++) |
2053 | seq_printf (seq, "%s", | 2053 | seq_printf (seq, "%s", |
2054 | conf->disks[i].rdev && | 2054 | conf->disks[i].rdev && |
2055 | conf->disks[i].rdev->in_sync ? "U" : "_"); | 2055 | test_bit(In_sync, &conf->disks[i].rdev->flags) ? "U" : "_"); |
2056 | seq_printf (seq, "]"); | 2056 | seq_printf (seq, "]"); |
2057 | #if RAID6_DUMPSTATE | 2057 | #if RAID6_DUMPSTATE |
2058 | seq_printf (seq, "\n"); | 2058 | seq_printf (seq, "\n"); |
@@ -2078,7 +2078,7 @@ static void print_raid6_conf (raid6_conf_t *conf) | |||
2078 | tmp = conf->disks + i; | 2078 | tmp = conf->disks + i; |
2079 | if (tmp->rdev) | 2079 | if (tmp->rdev) |
2080 | printk(" disk %d, o:%d, dev:%s\n", | 2080 | printk(" disk %d, o:%d, dev:%s\n", |
2081 | i, !tmp->rdev->faulty, | 2081 | i, !test_bit(Faulty, &tmp->rdev->flags), |
2082 | bdevname(tmp->rdev->bdev,b)); | 2082 | bdevname(tmp->rdev->bdev,b)); |
2083 | } | 2083 | } |
2084 | } | 2084 | } |
@@ -2092,12 +2092,12 @@ static int raid6_spare_active(mddev_t *mddev) | |||
2092 | for (i = 0; i < conf->raid_disks; i++) { | 2092 | for (i = 0; i < conf->raid_disks; i++) { |
2093 | tmp = conf->disks + i; | 2093 | tmp = conf->disks + i; |
2094 | if (tmp->rdev | 2094 | if (tmp->rdev |
2095 | && !tmp->rdev->faulty | 2095 | && !test_bit(Faulty, &tmp->rdev->flags) |
2096 | && !tmp->rdev->in_sync) { | 2096 | && !test_bit(In_sync, &tmp->rdev->flags)) { |
2097 | mddev->degraded--; | 2097 | mddev->degraded--; |
2098 | conf->failed_disks--; | 2098 | conf->failed_disks--; |
2099 | conf->working_disks++; | 2099 | conf->working_disks++; |
2100 | tmp->rdev->in_sync = 1; | 2100 | set_bit(In_sync, &tmp->rdev->flags); |
2101 | } | 2101 | } |
2102 | } | 2102 | } |
2103 | print_raid6_conf(conf); | 2103 | print_raid6_conf(conf); |
@@ -2114,7 +2114,7 @@ static int raid6_remove_disk(mddev_t *mddev, int number) | |||
2114 | print_raid6_conf(conf); | 2114 | print_raid6_conf(conf); |
2115 | rdev = p->rdev; | 2115 | rdev = p->rdev; |
2116 | if (rdev) { | 2116 | if (rdev) { |
2117 | if (rdev->in_sync || | 2117 | if (test_bit(In_sync, &rdev->flags) || |
2118 | atomic_read(&rdev->nr_pending)) { | 2118 | atomic_read(&rdev->nr_pending)) { |
2119 | err = -EBUSY; | 2119 | err = -EBUSY; |
2120 | goto abort; | 2120 | goto abort; |
@@ -2149,7 +2149,7 @@ static int raid6_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
2149 | */ | 2149 | */ |
2150 | for (disk=0; disk < mddev->raid_disks; disk++) | 2150 | for (disk=0; disk < mddev->raid_disks; disk++) |
2151 | if ((p=conf->disks + disk)->rdev == NULL) { | 2151 | if ((p=conf->disks + disk)->rdev == NULL) { |
2152 | rdev->in_sync = 0; | 2152 | clear_bit(In_sync, &rdev->flags); |
2153 | rdev->raid_disk = disk; | 2153 | rdev->raid_disk = disk; |
2154 | found = 1; | 2154 | found = 1; |
2155 | if (rdev->saved_raid_disk != disk) | 2155 | if (rdev->saved_raid_disk != disk) |