aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c64
1 files changed, 32 insertions, 32 deletions
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;