aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-03-18 21:46:39 -0400
committerNeilBrown <neilb@suse.de>2012-03-18 21:46:39 -0400
commitdafb20fa34320a472deb7442f25a0c086e0feb33 (patch)
tree2ff501805f8a6d08119f1f1a7248f579d52e491b /drivers/md/dm-raid.c
parentd6b42dcb995e6acd7cc276774e751ffc9f0ef4bf (diff)
md: tidy up rdev_for_each usage.
md.h has an 'rdev_for_each()' macro for iterating the rdevs in an mddev. However it uses the 'safe' version of list_for_each_entry, and so requires the extra variable, but doesn't include 'safe' in the name, which is useful documentation. Consequently some places use this safe version without needing it, and many use an explicity list_for_each entry. So: - rename rdev_for_each to rdev_for_each_safe - create a new rdev_for_each which uses the plain list_for_each_entry, - use the 'safe' version only where needed, and convert all other list_for_each_entry calls to use rdev_for_each. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r--drivers/md/dm-raid.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 787022c18187..c5a875d7b882 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -615,14 +615,14 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
615 615
616static void super_sync(struct mddev *mddev, struct md_rdev *rdev) 616static void super_sync(struct mddev *mddev, struct md_rdev *rdev)
617{ 617{
618 struct md_rdev *r, *t; 618 struct md_rdev *r;
619 uint64_t failed_devices; 619 uint64_t failed_devices;
620 struct dm_raid_superblock *sb; 620 struct dm_raid_superblock *sb;
621 621
622 sb = page_address(rdev->sb_page); 622 sb = page_address(rdev->sb_page);
623 failed_devices = le64_to_cpu(sb->failed_devices); 623 failed_devices = le64_to_cpu(sb->failed_devices);
624 624
625 rdev_for_each(r, t, mddev) 625 rdev_for_each(r, mddev)
626 if ((r->raid_disk >= 0) && test_bit(Faulty, &r->flags)) 626 if ((r->raid_disk >= 0) && test_bit(Faulty, &r->flags))
627 failed_devices |= (1ULL << r->raid_disk); 627 failed_devices |= (1ULL << r->raid_disk);
628 628
@@ -707,7 +707,7 @@ static int super_init_validation(struct mddev *mddev, struct md_rdev *rdev)
707 struct dm_raid_superblock *sb; 707 struct dm_raid_superblock *sb;
708 uint32_t new_devs = 0; 708 uint32_t new_devs = 0;
709 uint32_t rebuilds = 0; 709 uint32_t rebuilds = 0;
710 struct md_rdev *r, *t; 710 struct md_rdev *r;
711 struct dm_raid_superblock *sb2; 711 struct dm_raid_superblock *sb2;
712 712
713 sb = page_address(rdev->sb_page); 713 sb = page_address(rdev->sb_page);
@@ -750,7 +750,7 @@ static int super_init_validation(struct mddev *mddev, struct md_rdev *rdev)
750 * case the In_sync bit will /not/ be set and 750 * case the In_sync bit will /not/ be set and
751 * recovery_cp must be MaxSector. 751 * recovery_cp must be MaxSector.
752 */ 752 */
753 rdev_for_each(r, t, mddev) { 753 rdev_for_each(r, mddev) {
754 if (!test_bit(In_sync, &r->flags)) { 754 if (!test_bit(In_sync, &r->flags)) {
755 DMINFO("Device %d specified for rebuild: " 755 DMINFO("Device %d specified for rebuild: "
756 "Clearing superblock", r->raid_disk); 756 "Clearing superblock", r->raid_disk);
@@ -782,7 +782,7 @@ static int super_init_validation(struct mddev *mddev, struct md_rdev *rdev)
782 * Now we set the Faulty bit for those devices that are 782 * Now we set the Faulty bit for those devices that are
783 * recorded in the superblock as failed. 783 * recorded in the superblock as failed.
784 */ 784 */
785 rdev_for_each(r, t, mddev) { 785 rdev_for_each(r, mddev) {
786 if (!r->sb_page) 786 if (!r->sb_page)
787 continue; 787 continue;
788 sb2 = page_address(r->sb_page); 788 sb2 = page_address(r->sb_page);
@@ -855,11 +855,11 @@ static int super_validate(struct mddev *mddev, struct md_rdev *rdev)
855static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) 855static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
856{ 856{
857 int ret; 857 int ret;
858 struct md_rdev *rdev, *freshest, *tmp; 858 struct md_rdev *rdev, *freshest;
859 struct mddev *mddev = &rs->md; 859 struct mddev *mddev = &rs->md;
860 860
861 freshest = NULL; 861 freshest = NULL;
862 rdev_for_each(rdev, tmp, mddev) { 862 rdev_for_each(rdev, mddev) {
863 if (!rdev->meta_bdev) 863 if (!rdev->meta_bdev)
864 continue; 864 continue;
865 865
@@ -888,7 +888,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
888 if (super_validate(mddev, freshest)) 888 if (super_validate(mddev, freshest))
889 return -EINVAL; 889 return -EINVAL;
890 890
891 rdev_for_each(rdev, tmp, mddev) 891 rdev_for_each(rdev, mddev)
892 if ((rdev != freshest) && super_validate(mddev, rdev)) 892 if ((rdev != freshest) && super_validate(mddev, rdev))
893 return -EINVAL; 893 return -EINVAL;
894 894