aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-02-06 04:39:59 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:19 -0500
commitd089c6af10c2be5988f03667d6d22fe6085fbe5e (patch)
tree815eb0596bd7c908f30c268da6b5c5eff0e0bc21 /drivers/md
parent29ac4aa3fc68a86279aca50f20df4d614de2e204 (diff)
md: change ITERATE_RDEV to rdev_for_each
As this is more in line with common practice in the kernel. Also swap the args around to be more like list_for_each. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c4
-rw-r--r--drivers/md/faulty.c2
-rw-r--r--drivers/md/linear.c2
-rw-r--r--drivers/md/md.c64
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid0.c8
-rw-r--r--drivers/md/raid1.c2
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/md/raid5.c6
9 files changed, 46 insertions, 46 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 9231cd700fe8..a0585fb6da94 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -237,7 +237,7 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde
237 if (!page) 237 if (!page)
238 return ERR_PTR(-ENOMEM); 238 return ERR_PTR(-ENOMEM);
239 239
240 ITERATE_RDEV(mddev, rdev, tmp) { 240 rdev_for_each(rdev, tmp, mddev) {
241 if (! test_bit(In_sync, &rdev->flags) 241 if (! test_bit(In_sync, &rdev->flags)
242 || test_bit(Faulty, &rdev->flags)) 242 || test_bit(Faulty, &rdev->flags))
243 continue; 243 continue;
@@ -261,7 +261,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
261 struct list_head *tmp; 261 struct list_head *tmp;
262 mddev_t *mddev = bitmap->mddev; 262 mddev_t *mddev = bitmap->mddev;
263 263
264 ITERATE_RDEV(mddev, rdev, tmp) 264 rdev_for_each(rdev, tmp, mddev)
265 if (test_bit(In_sync, &rdev->flags) 265 if (test_bit(In_sync, &rdev->flags)
266 && !test_bit(Faulty, &rdev->flags)) { 266 && !test_bit(Faulty, &rdev->flags)) {
267 int size = PAGE_SIZE; 267 int size = PAGE_SIZE;
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index cf2ddce34118..d107ddceefcd 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -294,7 +294,7 @@ static int run(mddev_t *mddev)
294 } 294 }
295 conf->nfaults = 0; 295 conf->nfaults = 0;
296 296
297 ITERATE_RDEV(mddev, rdev, tmp) 297 rdev_for_each(rdev, tmp, mddev)
298 conf->rdev = rdev; 298 conf->rdev = rdev;
299 299
300 mddev->array_size = mddev->size; 300 mddev->array_size = mddev->size;
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 3dac1cfb8189..0b8511776b3e 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -122,7 +122,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
122 cnt = 0; 122 cnt = 0;
123 conf->array_size = 0; 123 conf->array_size = 0;
124 124
125 ITERATE_RDEV(mddev,rdev,tmp) { 125 rdev_for_each(rdev, tmp, mddev) {
126 int j = rdev->raid_disk; 126 int j = rdev->raid_disk;
127 dev_info_t *disk = conf->disks + j; 127 dev_info_t *disk = conf->disks + j;
128 128
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c912ce2752a4..e02022864f08 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -311,7 +311,7 @@ static mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr)
311 mdk_rdev_t * rdev; 311 mdk_rdev_t * rdev;
312 struct list_head *tmp; 312 struct list_head *tmp;
313 313
314 ITERATE_RDEV(mddev,rdev,tmp) { 314 rdev_for_each(rdev, tmp, mddev) {
315 if (rdev->desc_nr == nr) 315 if (rdev->desc_nr == nr)
316 return rdev; 316 return rdev;
317 } 317 }
@@ -323,7 +323,7 @@ static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev)
323 struct list_head *tmp; 323 struct list_head *tmp;
324 mdk_rdev_t *rdev; 324 mdk_rdev_t *rdev;
325 325
326 ITERATE_RDEV(mddev,rdev,tmp) { 326 rdev_for_each(rdev, tmp, mddev) {
327 if (rdev->bdev->bd_dev == dev) 327 if (rdev->bdev->bd_dev == dev)
328 return rdev; 328 return rdev;
329 } 329 }
@@ -943,7 +943,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
943 sb->state |= (1<<MD_SB_BITMAP_PRESENT); 943 sb->state |= (1<<MD_SB_BITMAP_PRESENT);
944 944
945 sb->disks[0].state = (1<<MD_DISK_REMOVED); 945 sb->disks[0].state = (1<<MD_DISK_REMOVED);
946 ITERATE_RDEV(mddev,rdev2,tmp) { 946 rdev_for_each(rdev2, tmp, mddev) {
947 mdp_disk_t *d; 947 mdp_disk_t *d;
948 int desc_nr; 948 int desc_nr;
949 if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags) 949 if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags)
@@ -1295,7 +1295,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1295 } 1295 }
1296 1296
1297 max_dev = 0; 1297 max_dev = 0;
1298 ITERATE_RDEV(mddev,rdev2,tmp) 1298 rdev_for_each(rdev2, tmp, mddev)
1299 if (rdev2->desc_nr+1 > max_dev) 1299 if (rdev2->desc_nr+1 > max_dev)
1300 max_dev = rdev2->desc_nr+1; 1300 max_dev = rdev2->desc_nr+1;
1301 1301
@@ -1304,7 +1304,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1304 for (i=0; i<max_dev;i++) 1304 for (i=0; i<max_dev;i++)
1305 sb->dev_roles[i] = cpu_to_le16(0xfffe); 1305 sb->dev_roles[i] = cpu_to_le16(0xfffe);
1306 1306
1307 ITERATE_RDEV(mddev,rdev2,tmp) { 1307 rdev_for_each(rdev2, tmp, mddev) {
1308 i = rdev2->desc_nr; 1308 i = rdev2->desc_nr;
1309 if (test_bit(Faulty, &rdev2->flags)) 1309 if (test_bit(Faulty, &rdev2->flags))
1310 sb->dev_roles[i] = cpu_to_le16(0xfffe); 1310 sb->dev_roles[i] = cpu_to_le16(0xfffe);
@@ -1342,8 +1342,8 @@ static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2)
1342 struct list_head *tmp, *tmp2; 1342 struct list_head *tmp, *tmp2;
1343 mdk_rdev_t *rdev, *rdev2; 1343 mdk_rdev_t *rdev, *rdev2;
1344 1344
1345 ITERATE_RDEV(mddev1,rdev,tmp) 1345 rdev_for_each(rdev, tmp, mddev1)
1346 ITERATE_RDEV(mddev2, rdev2, tmp2) 1346 rdev_for_each(rdev2, tmp2, mddev2)
1347 if (rdev->bdev->bd_contains == 1347 if (rdev->bdev->bd_contains ==
1348 rdev2->bdev->bd_contains) 1348 rdev2->bdev->bd_contains)
1349 return 1; 1349 return 1;
@@ -1516,7 +1516,7 @@ static void export_array(mddev_t *mddev)
1516 struct list_head *tmp; 1516 struct list_head *tmp;
1517 mdk_rdev_t *rdev; 1517 mdk_rdev_t *rdev;
1518 1518
1519 ITERATE_RDEV(mddev,rdev,tmp) { 1519 rdev_for_each(rdev, tmp, mddev) {
1520 if (!rdev->mddev) { 1520 if (!rdev->mddev) {
1521 MD_BUG(); 1521 MD_BUG();
1522 continue; 1522 continue;
@@ -1600,11 +1600,11 @@ static void md_print_devices(void)
1600 bitmap_print_sb(mddev->bitmap); 1600 bitmap_print_sb(mddev->bitmap);
1601 else 1601 else
1602 printk("%s: ", mdname(mddev)); 1602 printk("%s: ", mdname(mddev));
1603 ITERATE_RDEV(mddev,rdev,tmp2) 1603 rdev_for_each(rdev, tmp2, mddev)
1604 printk("<%s>", bdevname(rdev->bdev,b)); 1604 printk("<%s>", bdevname(rdev->bdev,b));
1605 printk("\n"); 1605 printk("\n");
1606 1606
1607 ITERATE_RDEV(mddev,rdev,tmp2) 1607 rdev_for_each(rdev, tmp2, mddev)
1608 print_rdev(rdev); 1608 print_rdev(rdev);
1609 } 1609 }
1610 printk("md: **********************************\n"); 1610 printk("md: **********************************\n");
@@ -1623,7 +1623,7 @@ static void sync_sbs(mddev_t * mddev, int nospares)
1623 mdk_rdev_t *rdev; 1623 mdk_rdev_t *rdev;
1624 struct list_head *tmp; 1624 struct list_head *tmp;
1625 1625
1626 ITERATE_RDEV(mddev,rdev,tmp) { 1626 rdev_for_each(rdev, tmp, mddev) {
1627 if (rdev->sb_events == mddev->events || 1627 if (rdev->sb_events == mddev->events ||
1628 (nospares && 1628 (nospares &&
1629 rdev->raid_disk < 0 && 1629 rdev->raid_disk < 0 &&
@@ -1730,7 +1730,7 @@ repeat:
1730 mdname(mddev),mddev->in_sync); 1730 mdname(mddev),mddev->in_sync);
1731 1731
1732 bitmap_update_sb(mddev->bitmap); 1732 bitmap_update_sb(mddev->bitmap);
1733 ITERATE_RDEV(mddev,rdev,tmp) { 1733 rdev_for_each(rdev, tmp, mddev) {
1734 char b[BDEVNAME_SIZE]; 1734 char b[BDEVNAME_SIZE];
1735 dprintk(KERN_INFO "md: "); 1735 dprintk(KERN_INFO "md: ");
1736 if (rdev->sb_loaded != 1) 1736 if (rdev->sb_loaded != 1)
@@ -2016,7 +2016,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
2016 mdk_rdev_t *rdev2; 2016 mdk_rdev_t *rdev2;
2017 2017
2018 mddev_lock(mddev); 2018 mddev_lock(mddev);
2019 ITERATE_RDEV(mddev, rdev2, tmp2) 2019 rdev_for_each(rdev2, tmp2, mddev)
2020 if (test_bit(AllReserved, &rdev2->flags) || 2020 if (test_bit(AllReserved, &rdev2->flags) ||
2021 (rdev->bdev == rdev2->bdev && 2021 (rdev->bdev == rdev2->bdev &&
2022 rdev != rdev2 && 2022 rdev != rdev2 &&
@@ -2202,7 +2202,7 @@ static void analyze_sbs(mddev_t * mddev)
2202 char b[BDEVNAME_SIZE]; 2202 char b[BDEVNAME_SIZE];
2203 2203
2204 freshest = NULL; 2204 freshest = NULL;
2205 ITERATE_RDEV(mddev,rdev,tmp) 2205 rdev_for_each(rdev, tmp, mddev)
2206 switch (super_types[mddev->major_version]. 2206 switch (super_types[mddev->major_version].
2207 load_super(rdev, freshest, mddev->minor_version)) { 2207 load_super(rdev, freshest, mddev->minor_version)) {
2208 case 1: 2208 case 1:
@@ -2223,7 +2223,7 @@ static void analyze_sbs(mddev_t * mddev)
2223 validate_super(mddev, freshest); 2223 validate_super(mddev, freshest);
2224 2224
2225 i = 0; 2225 i = 0;
2226 ITERATE_RDEV(mddev,rdev,tmp) { 2226 rdev_for_each(rdev, tmp, mddev) {
2227 if (rdev != freshest) 2227 if (rdev != freshest)
2228 if (super_types[mddev->major_version]. 2228 if (super_types[mddev->major_version].
2229 validate_super(mddev, rdev)) { 2229 validate_super(mddev, rdev)) {
@@ -3317,7 +3317,7 @@ static int do_md_run(mddev_t * mddev)
3317 } 3317 }
3318 3318
3319 /* devices must have minimum size of one chunk */ 3319 /* devices must have minimum size of one chunk */
3320 ITERATE_RDEV(mddev,rdev,tmp) { 3320 rdev_for_each(rdev, tmp, mddev) {
3321 if (test_bit(Faulty, &rdev->flags)) 3321 if (test_bit(Faulty, &rdev->flags))
3322 continue; 3322 continue;
3323 if (rdev->size < chunk_size / 1024) { 3323 if (rdev->size < chunk_size / 1024) {
@@ -3344,7 +3344,7 @@ static int do_md_run(mddev_t * mddev)
3344 * the only valid external interface is through the md 3344 * the only valid external interface is through the md
3345 * device. 3345 * device.
3346 */ 3346 */
3347 ITERATE_RDEV(mddev,rdev,tmp) { 3347 rdev_for_each(rdev, tmp, mddev) {
3348 if (test_bit(Faulty, &rdev->flags)) 3348 if (test_bit(Faulty, &rdev->flags))
3349 continue; 3349 continue;
3350 sync_blockdev(rdev->bdev); 3350 sync_blockdev(rdev->bdev);
@@ -3410,8 +3410,8 @@ static int do_md_run(mddev_t * mddev)
3410 mdk_rdev_t *rdev2; 3410 mdk_rdev_t *rdev2;
3411 struct list_head *tmp2; 3411 struct list_head *tmp2;
3412 int warned = 0; 3412 int warned = 0;
3413 ITERATE_RDEV(mddev, rdev, tmp) { 3413 rdev_for_each(rdev, tmp, mddev) {
3414 ITERATE_RDEV(mddev, rdev2, tmp2) { 3414 rdev_for_each(rdev2, tmp2, mddev) {
3415 if (rdev < rdev2 && 3415 if (rdev < rdev2 &&
3416 rdev->bdev->bd_contains == 3416 rdev->bdev->bd_contains ==
3417 rdev2->bdev->bd_contains) { 3417 rdev2->bdev->bd_contains) {
@@ -3471,7 +3471,7 @@ static int do_md_run(mddev_t * mddev)
3471 mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */ 3471 mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */
3472 mddev->in_sync = 1; 3472 mddev->in_sync = 1;
3473 3473
3474 ITERATE_RDEV(mddev,rdev,tmp) 3474 rdev_for_each(rdev, tmp, mddev)
3475 if (rdev->raid_disk >= 0) { 3475 if (rdev->raid_disk >= 0) {
3476 char nm[20]; 3476 char nm[20];
3477 sprintf(nm, "rd%d", rdev->raid_disk); 3477 sprintf(nm, "rd%d", rdev->raid_disk);
@@ -3504,7 +3504,7 @@ static int do_md_run(mddev_t * mddev)
3504 if (mddev->degraded && !mddev->sync_thread) { 3504 if (mddev->degraded && !mddev->sync_thread) {
3505 struct list_head *rtmp; 3505 struct list_head *rtmp;
3506 int spares = 0; 3506 int spares = 0;
3507 ITERATE_RDEV(mddev,rdev,rtmp) 3507 rdev_for_each(rdev, rtmp, mddev)
3508 if (rdev->raid_disk >= 0 && 3508 if (rdev->raid_disk >= 0 &&
3509 !test_bit(In_sync, &rdev->flags) && 3509 !test_bit(In_sync, &rdev->flags) &&
3510 !test_bit(Faulty, &rdev->flags)) 3510 !test_bit(Faulty, &rdev->flags))
@@ -3681,7 +3681,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
3681 } 3681 }
3682 mddev->bitmap_offset = 0; 3682 mddev->bitmap_offset = 0;
3683 3683
3684 ITERATE_RDEV(mddev,rdev,tmp) 3684 rdev_for_each(rdev, tmp, mddev)
3685 if (rdev->raid_disk >= 0) { 3685 if (rdev->raid_disk >= 0) {
3686 char nm[20]; 3686 char nm[20];
3687 sprintf(nm, "rd%d", rdev->raid_disk); 3687 sprintf(nm, "rd%d", rdev->raid_disk);
@@ -3723,7 +3723,7 @@ static void autorun_array(mddev_t *mddev)
3723 3723
3724 printk(KERN_INFO "md: running: "); 3724 printk(KERN_INFO "md: running: ");
3725 3725
3726 ITERATE_RDEV(mddev,rdev,tmp) { 3726 rdev_for_each(rdev, tmp, mddev) {
3727 char b[BDEVNAME_SIZE]; 3727 char b[BDEVNAME_SIZE];
3728 printk("<%s>", bdevname(rdev->bdev,b)); 3728 printk("<%s>", bdevname(rdev->bdev,b));
3729 } 3729 }
@@ -3851,7 +3851,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg)
3851 struct list_head *tmp; 3851 struct list_head *tmp;
3852 3852
3853 nr=working=active=failed=spare=0; 3853 nr=working=active=failed=spare=0;
3854 ITERATE_RDEV(mddev,rdev,tmp) { 3854 rdev_for_each(rdev, tmp, mddev) {
3855 nr++; 3855 nr++;
3856 if (test_bit(Faulty, &rdev->flags)) 3856 if (test_bit(Faulty, &rdev->flags))
3857 failed++; 3857 failed++;
@@ -4391,7 +4391,7 @@ static int update_size(mddev_t *mddev, unsigned long size)
4391 */ 4391 */
4392 if (mddev->sync_thread) 4392 if (mddev->sync_thread)
4393 return -EBUSY; 4393 return -EBUSY;
4394 ITERATE_RDEV(mddev,rdev,tmp) { 4394 rdev_for_each(rdev, tmp, mddev) {
4395 sector_t avail; 4395 sector_t avail;
4396 avail = rdev->size * 2; 4396 avail = rdev->size * 2;
4397 4397
@@ -5132,7 +5132,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
5132 } 5132 }
5133 5133
5134 size = 0; 5134 size = 0;
5135 ITERATE_RDEV(mddev,rdev,tmp2) { 5135 rdev_for_each(rdev, tmp2, mddev) {
5136 char b[BDEVNAME_SIZE]; 5136 char b[BDEVNAME_SIZE];
5137 seq_printf(seq, " %s[%d]", 5137 seq_printf(seq, " %s[%d]",
5138 bdevname(rdev->bdev,b), rdev->desc_nr); 5138 bdevname(rdev->bdev,b), rdev->desc_nr);
@@ -5288,7 +5288,7 @@ static int is_mddev_idle(mddev_t *mddev)
5288 long curr_events; 5288 long curr_events;
5289 5289
5290 idle = 1; 5290 idle = 1;
5291 ITERATE_RDEV(mddev,rdev,tmp) { 5291 rdev_for_each(rdev, tmp, mddev) {
5292 struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; 5292 struct gendisk *disk = rdev->bdev->bd_contains->bd_disk;
5293 curr_events = disk_stat_read(disk, sectors[0]) + 5293 curr_events = disk_stat_read(disk, sectors[0]) +
5294 disk_stat_read(disk, sectors[1]) - 5294 disk_stat_read(disk, sectors[1]) -
@@ -5515,7 +5515,7 @@ void md_do_sync(mddev_t *mddev)
5515 /* recovery follows the physical size of devices */ 5515 /* recovery follows the physical size of devices */
5516 max_sectors = mddev->size << 1; 5516 max_sectors = mddev->size << 1;
5517 j = MaxSector; 5517 j = MaxSector;
5518 ITERATE_RDEV(mddev,rdev,rtmp) 5518 rdev_for_each(rdev, rtmp, mddev)
5519 if (rdev->raid_disk >= 0 && 5519 if (rdev->raid_disk >= 0 &&
5520 !test_bit(Faulty, &rdev->flags) && 5520 !test_bit(Faulty, &rdev->flags) &&
5521 !test_bit(In_sync, &rdev->flags) && 5521 !test_bit(In_sync, &rdev->flags) &&
@@ -5668,7 +5668,7 @@ void md_do_sync(mddev_t *mddev)
5668 } else { 5668 } else {
5669 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) 5669 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery))
5670 mddev->curr_resync = MaxSector; 5670 mddev->curr_resync = MaxSector;
5671 ITERATE_RDEV(mddev,rdev,rtmp) 5671 rdev_for_each(rdev, rtmp, mddev)
5672 if (rdev->raid_disk >= 0 && 5672 if (rdev->raid_disk >= 0 &&
5673 !test_bit(Faulty, &rdev->flags) && 5673 !test_bit(Faulty, &rdev->flags) &&
5674 !test_bit(In_sync, &rdev->flags) && 5674 !test_bit(In_sync, &rdev->flags) &&
@@ -5706,7 +5706,7 @@ static int remove_and_add_spares(mddev_t *mddev)
5706 struct list_head *rtmp; 5706 struct list_head *rtmp;
5707 int spares = 0; 5707 int spares = 0;
5708 5708
5709 ITERATE_RDEV(mddev,rdev,rtmp) 5709 rdev_for_each(rdev, rtmp, mddev)
5710 if (rdev->raid_disk >= 0 && 5710 if (rdev->raid_disk >= 0 &&
5711 !mddev->external && 5711 !mddev->external &&
5712 (test_bit(Faulty, &rdev->flags) || 5712 (test_bit(Faulty, &rdev->flags) ||
@@ -5722,7 +5722,7 @@ static int remove_and_add_spares(mddev_t *mddev)
5722 } 5722 }
5723 5723
5724 if (mddev->degraded) { 5724 if (mddev->degraded) {
5725 ITERATE_RDEV(mddev,rdev,rtmp) 5725 rdev_for_each(rdev, rtmp, mddev)
5726 if (rdev->raid_disk < 0 5726 if (rdev->raid_disk < 0
5727 && !test_bit(Faulty, &rdev->flags)) { 5727 && !test_bit(Faulty, &rdev->flags)) {
5728 rdev->recovery_offset = 0; 5728 rdev->recovery_offset = 0;
@@ -5836,7 +5836,7 @@ void md_check_recovery(mddev_t *mddev)
5836 * information must be scrapped 5836 * information must be scrapped
5837 */ 5837 */
5838 if (!mddev->degraded) 5838 if (!mddev->degraded)
5839 ITERATE_RDEV(mddev,rdev,rtmp) 5839 rdev_for_each(rdev, rtmp, mddev)
5840 rdev->saved_raid_disk = -1; 5840 rdev->saved_raid_disk = -1;
5841 5841
5842 mddev->recovery = 0; 5842 mddev->recovery = 0;
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index eb631ebed686..3f299d835a2b 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -436,7 +436,7 @@ static int multipath_run (mddev_t *mddev)
436 } 436 }
437 437
438 conf->working_disks = 0; 438 conf->working_disks = 0;
439 ITERATE_RDEV(mddev,rdev,tmp) { 439 rdev_for_each(rdev, tmp, mddev) {
440 disk_idx = rdev->raid_disk; 440 disk_idx = rdev->raid_disk;
441 if (disk_idx < 0 || 441 if (disk_idx < 0 ||
442 disk_idx >= mddev->raid_disks) 442 disk_idx >= mddev->raid_disks)
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index f8e591708d1f..818b48284096 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -72,11 +72,11 @@ static int create_strip_zones (mddev_t *mddev)
72 */ 72 */
73 conf->nr_strip_zones = 0; 73 conf->nr_strip_zones = 0;
74 74
75 ITERATE_RDEV(mddev,rdev1,tmp1) { 75 rdev_for_each(rdev1, tmp1, mddev) {
76 printk("raid0: looking at %s\n", 76 printk("raid0: looking at %s\n",
77 bdevname(rdev1->bdev,b)); 77 bdevname(rdev1->bdev,b));
78 c = 0; 78 c = 0;
79 ITERATE_RDEV(mddev,rdev2,tmp2) { 79 rdev_for_each(rdev2, tmp2, mddev) {
80 printk("raid0: comparing %s(%llu)", 80 printk("raid0: comparing %s(%llu)",
81 bdevname(rdev1->bdev,b), 81 bdevname(rdev1->bdev,b),
82 (unsigned long long)rdev1->size); 82 (unsigned long long)rdev1->size);
@@ -124,7 +124,7 @@ static int create_strip_zones (mddev_t *mddev)
124 cnt = 0; 124 cnt = 0;
125 smallest = NULL; 125 smallest = NULL;
126 zone->dev = conf->devlist; 126 zone->dev = conf->devlist;
127 ITERATE_RDEV(mddev, rdev1, tmp1) { 127 rdev_for_each(rdev1, tmp1, mddev) {
128 int j = rdev1->raid_disk; 128 int j = rdev1->raid_disk;
129 129
130 if (j < 0 || j >= mddev->raid_disks) { 130 if (j < 0 || j >= mddev->raid_disks) {
@@ -293,7 +293,7 @@ static int raid0_run (mddev_t *mddev)
293 293
294 /* calculate array device size */ 294 /* calculate array device size */
295 mddev->array_size = 0; 295 mddev->array_size = 0;
296 ITERATE_RDEV(mddev,rdev,tmp) 296 rdev_for_each(rdev, tmp, mddev)
297 mddev->array_size += rdev->size; 297 mddev->array_size += rdev->size;
298 298
299 printk("raid0 : md_size is %llu blocks.\n", 299 printk("raid0 : md_size is %llu blocks.\n",
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ae7c15207df5..5c7fef091cec 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1887,7 +1887,7 @@ static int run(mddev_t *mddev)
1887 if (!conf->r1bio_pool) 1887 if (!conf->r1bio_pool)
1888 goto out_no_mem; 1888 goto out_no_mem;
1889 1889
1890 ITERATE_RDEV(mddev, rdev, tmp) { 1890 rdev_for_each(rdev, tmp, mddev) {
1891 disk_idx = rdev->raid_disk; 1891 disk_idx = rdev->raid_disk;
1892 if (disk_idx >= mddev->raid_disks 1892 if (disk_idx >= mddev->raid_disks
1893 || disk_idx < 0) 1893 || disk_idx < 0)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index d6f12882424d..017f58113c33 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2026,7 +2026,7 @@ static int run(mddev_t *mddev)
2026 goto out_free_conf; 2026 goto out_free_conf;
2027 } 2027 }
2028 2028
2029 ITERATE_RDEV(mddev, rdev, tmp) { 2029 rdev_for_each(rdev, tmp, mddev) {
2030 disk_idx = rdev->raid_disk; 2030 disk_idx = rdev->raid_disk;
2031 if (disk_idx >= mddev->raid_disks 2031 if (disk_idx >= mddev->raid_disks
2032 || disk_idx < 0) 2032 || disk_idx < 0)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e946de6f46bc..63bfb0757829 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4136,7 +4136,7 @@ static int run(mddev_t *mddev)
4136 4136
4137 pr_debug("raid5: run(%s) called.\n", mdname(mddev)); 4137 pr_debug("raid5: run(%s) called.\n", mdname(mddev));
4138 4138
4139 ITERATE_RDEV(mddev,rdev,tmp) { 4139 rdev_for_each(rdev, tmp, mddev) {
4140 raid_disk = rdev->raid_disk; 4140 raid_disk = rdev->raid_disk;
4141 if (raid_disk >= conf->raid_disks 4141 if (raid_disk >= conf->raid_disks
4142 || raid_disk < 0) 4142 || raid_disk < 0)
@@ -4549,7 +4549,7 @@ static int raid5_start_reshape(mddev_t *mddev)
4549 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) 4549 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
4550 return -EBUSY; 4550 return -EBUSY;
4551 4551
4552 ITERATE_RDEV(mddev, rdev, rtmp) 4552 rdev_for_each(rdev, rtmp, mddev)
4553 if (rdev->raid_disk < 0 && 4553 if (rdev->raid_disk < 0 &&
4554 !test_bit(Faulty, &rdev->flags)) 4554 !test_bit(Faulty, &rdev->flags))
4555 spares++; 4555 spares++;
@@ -4571,7 +4571,7 @@ static int raid5_start_reshape(mddev_t *mddev)
4571 /* Add some new drives, as many as will fit. 4571 /* Add some new drives, as many as will fit.
4572 * We know there are enough to make the newly sized array work. 4572 * We know there are enough to make the newly sized array work.
4573 */ 4573 */
4574 ITERATE_RDEV(mddev, rdev, rtmp) 4574 rdev_for_each(rdev, rtmp, mddev)
4575 if (rdev->raid_disk < 0 && 4575 if (rdev->raid_disk < 0 &&
4576 !test_bit(Faulty, &rdev->flags)) { 4576 !test_bit(Faulty, &rdev->flags)) {
4577 if (raid5_add_disk(mddev, rdev)) { 4577 if (raid5_add_disk(mddev, rdev)) {