diff options
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 26114f40bde6..867f06ae33d9 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -512,7 +512,7 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) | |||
512 | disk = r10_bio->devs[slot].devnum; | 512 | disk = r10_bio->devs[slot].devnum; |
513 | 513 | ||
514 | while ((rdev = rcu_dereference(conf->mirrors[disk].rdev)) == NULL || | 514 | while ((rdev = rcu_dereference(conf->mirrors[disk].rdev)) == NULL || |
515 | !rdev->in_sync) { | 515 | !test_bit(In_sync, &rdev->flags)) { |
516 | slot++; | 516 | slot++; |
517 | if (slot == conf->copies) { | 517 | if (slot == conf->copies) { |
518 | slot = 0; | 518 | slot = 0; |
@@ -529,7 +529,7 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) | |||
529 | slot = 0; | 529 | slot = 0; |
530 | disk = r10_bio->devs[slot].devnum; | 530 | disk = r10_bio->devs[slot].devnum; |
531 | while ((rdev=rcu_dereference(conf->mirrors[disk].rdev)) == NULL || | 531 | while ((rdev=rcu_dereference(conf->mirrors[disk].rdev)) == NULL || |
532 | !rdev->in_sync) { | 532 | !test_bit(In_sync, &rdev->flags)) { |
533 | slot ++; | 533 | slot ++; |
534 | if (slot == conf->copies) { | 534 | if (slot == conf->copies) { |
535 | disk = -1; | 535 | disk = -1; |
@@ -549,7 +549,7 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) | |||
549 | 549 | ||
550 | 550 | ||
551 | if ((rdev=rcu_dereference(conf->mirrors[ndisk].rdev)) == NULL || | 551 | if ((rdev=rcu_dereference(conf->mirrors[ndisk].rdev)) == NULL || |
552 | !rdev->in_sync) | 552 | !test_bit(In_sync, &rdev->flags)) |
553 | continue; | 553 | continue; |
554 | 554 | ||
555 | if (!atomic_read(&rdev->nr_pending)) { | 555 | if (!atomic_read(&rdev->nr_pending)) { |
@@ -585,7 +585,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
585 | rcu_read_lock(); | 585 | rcu_read_lock(); |
586 | for (i=0; i<mddev->raid_disks; i++) { | 586 | for (i=0; i<mddev->raid_disks; i++) { |
587 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | 587 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); |
588 | if (rdev && !rdev->faulty && atomic_read(&rdev->nr_pending)) { | 588 | if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { |
589 | request_queue_t *r_queue = bdev_get_queue(rdev->bdev); | 589 | request_queue_t *r_queue = bdev_get_queue(rdev->bdev); |
590 | 590 | ||
591 | atomic_inc(&rdev->nr_pending); | 591 | atomic_inc(&rdev->nr_pending); |
@@ -616,7 +616,7 @@ static int raid10_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
616 | rcu_read_lock(); | 616 | rcu_read_lock(); |
617 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | 617 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { |
618 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | 618 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); |
619 | if (rdev && !rdev->faulty) { | 619 | if (rdev && !test_bit(Faulty, &rdev->flags)) { |
620 | struct block_device *bdev = rdev->bdev; | 620 | struct block_device *bdev = rdev->bdev; |
621 | request_queue_t *r_queue = bdev_get_queue(bdev); | 621 | request_queue_t *r_queue = bdev_get_queue(bdev); |
622 | 622 | ||
@@ -771,7 +771,7 @@ static int make_request(request_queue_t *q, struct bio * bio) | |||
771 | int d = r10_bio->devs[i].devnum; | 771 | int d = r10_bio->devs[i].devnum; |
772 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[d].rdev); | 772 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[d].rdev); |
773 | if (rdev && | 773 | if (rdev && |
774 | !rdev->faulty) { | 774 | !test_bit(Faulty, &rdev->flags)) { |
775 | atomic_inc(&rdev->nr_pending); | 775 | atomic_inc(&rdev->nr_pending); |
776 | r10_bio->devs[i].bio = bio; | 776 | r10_bio->devs[i].bio = bio; |
777 | } else | 777 | } else |
@@ -826,7 +826,7 @@ static void status(struct seq_file *seq, mddev_t *mddev) | |||
826 | for (i = 0; i < conf->raid_disks; i++) | 826 | for (i = 0; i < conf->raid_disks; i++) |
827 | seq_printf(seq, "%s", | 827 | seq_printf(seq, "%s", |
828 | conf->mirrors[i].rdev && | 828 | conf->mirrors[i].rdev && |
829 | conf->mirrors[i].rdev->in_sync ? "U" : "_"); | 829 | test_bit(In_sync, &conf->mirrors[i].rdev->flags) ? "U" : "_"); |
830 | seq_printf(seq, "]"); | 830 | seq_printf(seq, "]"); |
831 | } | 831 | } |
832 | 832 | ||
@@ -841,7 +841,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
841 | * next level up know. | 841 | * next level up know. |
842 | * else mark the drive as failed | 842 | * else mark the drive as failed |
843 | */ | 843 | */ |
844 | if (rdev->in_sync | 844 | if (test_bit(In_sync, &rdev->flags) |
845 | && conf->working_disks == 1) | 845 | && conf->working_disks == 1) |
846 | /* | 846 | /* |
847 | * Don't fail the drive, just return an IO error. | 847 | * Don't fail the drive, just return an IO error. |
@@ -851,7 +851,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
851 | * really dead" tests... | 851 | * really dead" tests... |
852 | */ | 852 | */ |
853 | return; | 853 | return; |
854 | if (rdev->in_sync) { | 854 | if (test_bit(In_sync, &rdev->flags)) { |
855 | mddev->degraded++; | 855 | mddev->degraded++; |
856 | conf->working_disks--; | 856 | conf->working_disks--; |
857 | /* | 857 | /* |
@@ -859,8 +859,8 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
859 | */ | 859 | */ |
860 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 860 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); |
861 | } | 861 | } |
862 | rdev->in_sync = 0; | 862 | clear_bit(In_sync, &rdev->flags); |
863 | rdev->faulty = 1; | 863 | set_bit(Faulty, &rdev->flags); |
864 | mddev->sb_dirty = 1; | 864 | mddev->sb_dirty = 1; |
865 | printk(KERN_ALERT "raid10: Disk failure on %s, disabling device. \n" | 865 | printk(KERN_ALERT "raid10: Disk failure on %s, disabling device. \n" |
866 | " Operation continuing on %d devices\n", | 866 | " Operation continuing on %d devices\n", |
@@ -885,7 +885,8 @@ static void print_conf(conf_t *conf) | |||
885 | tmp = conf->mirrors + i; | 885 | tmp = conf->mirrors + i; |
886 | if (tmp->rdev) | 886 | if (tmp->rdev) |
887 | printk(" disk %d, wo:%d, o:%d, dev:%s\n", | 887 | printk(" disk %d, wo:%d, o:%d, dev:%s\n", |
888 | i, !tmp->rdev->in_sync, !tmp->rdev->faulty, | 888 | i, !test_bit(In_sync, &tmp->rdev->flags), |
889 | !test_bit(Faulty, &tmp->rdev->flags), | ||
889 | bdevname(tmp->rdev->bdev,b)); | 890 | bdevname(tmp->rdev->bdev,b)); |
890 | } | 891 | } |
891 | } | 892 | } |
@@ -938,11 +939,11 @@ static int raid10_spare_active(mddev_t *mddev) | |||
938 | for (i = 0; i < conf->raid_disks; i++) { | 939 | for (i = 0; i < conf->raid_disks; i++) { |
939 | tmp = conf->mirrors + i; | 940 | tmp = conf->mirrors + i; |
940 | if (tmp->rdev | 941 | if (tmp->rdev |
941 | && !tmp->rdev->faulty | 942 | && !test_bit(Faulty, &tmp->rdev->flags) |
942 | && !tmp->rdev->in_sync) { | 943 | && !test_bit(In_sync, &tmp->rdev->flags)) { |
943 | conf->working_disks++; | 944 | conf->working_disks++; |
944 | mddev->degraded--; | 945 | mddev->degraded--; |
945 | tmp->rdev->in_sync = 1; | 946 | set_bit(In_sync, &tmp->rdev->flags); |
946 | } | 947 | } |
947 | } | 948 | } |
948 | 949 | ||
@@ -1000,7 +1001,7 @@ static int raid10_remove_disk(mddev_t *mddev, int number) | |||
1000 | print_conf(conf); | 1001 | print_conf(conf); |
1001 | rdev = p->rdev; | 1002 | rdev = p->rdev; |
1002 | if (rdev) { | 1003 | if (rdev) { |
1003 | if (rdev->in_sync || | 1004 | if (test_bit(In_sync, &rdev->flags) || |
1004 | atomic_read(&rdev->nr_pending)) { | 1005 | atomic_read(&rdev->nr_pending)) { |
1005 | err = -EBUSY; | 1006 | err = -EBUSY; |
1006 | goto abort; | 1007 | goto abort; |
@@ -1416,7 +1417,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1416 | 1417 | ||
1417 | for (i=0 ; i<conf->raid_disks; i++) | 1418 | for (i=0 ; i<conf->raid_disks; i++) |
1418 | if (conf->mirrors[i].rdev && | 1419 | if (conf->mirrors[i].rdev && |
1419 | !conf->mirrors[i].rdev->in_sync) { | 1420 | !test_bit(In_sync, &conf->mirrors[i].rdev->flags)) { |
1420 | /* want to reconstruct this device */ | 1421 | /* want to reconstruct this device */ |
1421 | r10bio_t *rb2 = r10_bio; | 1422 | r10bio_t *rb2 = r10_bio; |
1422 | 1423 | ||
@@ -1437,7 +1438,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1437 | for (j=0; j<conf->copies;j++) { | 1438 | for (j=0; j<conf->copies;j++) { |
1438 | int d = r10_bio->devs[j].devnum; | 1439 | int d = r10_bio->devs[j].devnum; |
1439 | if (conf->mirrors[d].rdev && | 1440 | if (conf->mirrors[d].rdev && |
1440 | conf->mirrors[d].rdev->in_sync) { | 1441 | test_bit(In_sync, &conf->mirrors[d].rdev->flags)) { |
1441 | /* This is where we read from */ | 1442 | /* This is where we read from */ |
1442 | bio = r10_bio->devs[0].bio; | 1443 | bio = r10_bio->devs[0].bio; |
1443 | bio->bi_next = biolist; | 1444 | bio->bi_next = biolist; |
@@ -1513,7 +1514,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1513 | bio = r10_bio->devs[i].bio; | 1514 | bio = r10_bio->devs[i].bio; |
1514 | bio->bi_end_io = NULL; | 1515 | bio->bi_end_io = NULL; |
1515 | if (conf->mirrors[d].rdev == NULL || | 1516 | if (conf->mirrors[d].rdev == NULL || |
1516 | conf->mirrors[d].rdev->faulty) | 1517 | test_bit(Faulty, &conf->mirrors[d].rdev->flags)) |
1517 | continue; | 1518 | continue; |
1518 | atomic_inc(&conf->mirrors[d].rdev->nr_pending); | 1519 | atomic_inc(&conf->mirrors[d].rdev->nr_pending); |
1519 | atomic_inc(&r10_bio->remaining); | 1520 | atomic_inc(&r10_bio->remaining); |
@@ -1699,7 +1700,7 @@ static int run(mddev_t *mddev) | |||
1699 | mddev->queue->max_sectors = (PAGE_SIZE>>9); | 1700 | mddev->queue->max_sectors = (PAGE_SIZE>>9); |
1700 | 1701 | ||
1701 | disk->head_position = 0; | 1702 | disk->head_position = 0; |
1702 | if (!rdev->faulty && rdev->in_sync) | 1703 | if (!test_bit(Faulty, &rdev->flags) && test_bit(In_sync, &rdev->flags)) |
1703 | conf->working_disks++; | 1704 | conf->working_disks++; |
1704 | } | 1705 | } |
1705 | conf->raid_disks = mddev->raid_disks; | 1706 | conf->raid_disks = mddev->raid_disks; |