Commit d089c6af authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

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: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 29ac4aa3
...@@ -237,7 +237,7 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde ...@@ -237,7 +237,7 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde
if (!page) if (!page)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ITERATE_RDEV(mddev, rdev, tmp) { rdev_for_each(rdev, tmp, mddev) {
if (! test_bit(In_sync, &rdev->flags) if (! test_bit(In_sync, &rdev->flags)
|| test_bit(Faulty, &rdev->flags)) || test_bit(Faulty, &rdev->flags))
continue; continue;
...@@ -261,7 +261,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) ...@@ -261,7 +261,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
struct list_head *tmp; struct list_head *tmp;
mddev_t *mddev = bitmap->mddev; mddev_t *mddev = bitmap->mddev;
ITERATE_RDEV(mddev, rdev, tmp) rdev_for_each(rdev, tmp, mddev)
if (test_bit(In_sync, &rdev->flags) if (test_bit(In_sync, &rdev->flags)
&& !test_bit(Faulty, &rdev->flags)) { && !test_bit(Faulty, &rdev->flags)) {
int size = PAGE_SIZE; int size = PAGE_SIZE;
......
...@@ -294,7 +294,7 @@ static int run(mddev_t *mddev) ...@@ -294,7 +294,7 @@ static int run(mddev_t *mddev)
} }
conf->nfaults = 0; conf->nfaults = 0;
ITERATE_RDEV(mddev, rdev, tmp) rdev_for_each(rdev, tmp, mddev)
conf->rdev = rdev; conf->rdev = rdev;
mddev->array_size = mddev->size; mddev->array_size = mddev->size;
......
...@@ -122,7 +122,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) ...@@ -122,7 +122,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
cnt = 0; cnt = 0;
conf->array_size = 0; conf->array_size = 0;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
int j = rdev->raid_disk; int j = rdev->raid_disk;
dev_info_t *disk = conf->disks + j; dev_info_t *disk = conf->disks + j;
......
...@@ -311,7 +311,7 @@ static mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr) ...@@ -311,7 +311,7 @@ static mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr)
mdk_rdev_t * rdev; mdk_rdev_t * rdev;
struct list_head *tmp; struct list_head *tmp;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (rdev->desc_nr == nr) if (rdev->desc_nr == nr)
return rdev; return rdev;
} }
...@@ -323,7 +323,7 @@ static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev) ...@@ -323,7 +323,7 @@ static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev)
struct list_head *tmp; struct list_head *tmp;
mdk_rdev_t *rdev; mdk_rdev_t *rdev;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (rdev->bdev->bd_dev == dev) if (rdev->bdev->bd_dev == dev)
return rdev; return rdev;
} }
...@@ -943,7 +943,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) ...@@ -943,7 +943,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
sb->state |= (1<<MD_SB_BITMAP_PRESENT); sb->state |= (1<<MD_SB_BITMAP_PRESENT);
sb->disks[0].state = (1<<MD_DISK_REMOVED); sb->disks[0].state = (1<<MD_DISK_REMOVED);
ITERATE_RDEV(mddev,rdev2,tmp) { rdev_for_each(rdev2, tmp, mddev) {
mdp_disk_t *d; mdp_disk_t *d;
int desc_nr; int desc_nr;
if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags) 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,7 +1295,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
} }
max_dev = 0; max_dev = 0;
ITERATE_RDEV(mddev,rdev2,tmp) rdev_for_each(rdev2, tmp, mddev)
if (rdev2->desc_nr+1 > max_dev) if (rdev2->desc_nr+1 > max_dev)
max_dev = rdev2->desc_nr+1; max_dev = rdev2->desc_nr+1;
...@@ -1304,7 +1304,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) ...@@ -1304,7 +1304,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
for (i=0; i<max_dev;i++) for (i=0; i<max_dev;i++)
sb->dev_roles[i] = cpu_to_le16(0xfffe); sb->dev_roles[i] = cpu_to_le16(0xfffe);
ITERATE_RDEV(mddev,rdev2,tmp) { rdev_for_each(rdev2, tmp, mddev) {
i = rdev2->desc_nr; i = rdev2->desc_nr;
if (test_bit(Faulty, &rdev2->flags)) if (test_bit(Faulty, &rdev2->flags))
sb->dev_roles[i] = cpu_to_le16(0xfffe); sb->dev_roles[i] = cpu_to_le16(0xfffe);
...@@ -1342,8 +1342,8 @@ static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) ...@@ -1342,8 +1342,8 @@ static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2)
struct list_head *tmp, *tmp2; struct list_head *tmp, *tmp2;
mdk_rdev_t *rdev, *rdev2; mdk_rdev_t *rdev, *rdev2;
ITERATE_RDEV(mddev1,rdev,tmp) rdev_for_each(rdev, tmp, mddev1)
ITERATE_RDEV(mddev2, rdev2, tmp2) rdev_for_each(rdev2, tmp2, mddev2)
if (rdev->bdev->bd_contains == if (rdev->bdev->bd_contains ==
rdev2->bdev->bd_contains) rdev2->bdev->bd_contains)
return 1; return 1;
...@@ -1516,7 +1516,7 @@ static void export_array(mddev_t *mddev) ...@@ -1516,7 +1516,7 @@ static void export_array(mddev_t *mddev)
struct list_head *tmp; struct list_head *tmp;
mdk_rdev_t *rdev; mdk_rdev_t *rdev;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (!rdev->mddev) { if (!rdev->mddev) {
MD_BUG(); MD_BUG();
continue; continue;
...@@ -1600,11 +1600,11 @@ static void md_print_devices(void) ...@@ -1600,11 +1600,11 @@ static void md_print_devices(void)
bitmap_print_sb(mddev->bitmap); bitmap_print_sb(mddev->bitmap);
else else
printk("%s: ", mdname(mddev)); printk("%s: ", mdname(mddev));
ITERATE_RDEV(mddev,rdev,tmp2) rdev_for_each(rdev, tmp2, mddev)
printk("<%s>", bdevname(rdev->bdev,b)); printk("<%s>", bdevname(rdev->bdev,b));
printk("\n"); printk("\n");
ITERATE_RDEV(mddev,rdev,tmp2) rdev_for_each(rdev, tmp2, mddev)
print_rdev(rdev); print_rdev(rdev);
} }
printk("md: **********************************\n"); printk("md: **********************************\n");
...@@ -1623,7 +1623,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) ...@@ -1623,7 +1623,7 @@ static void sync_sbs(mddev_t * mddev, int nospares)
mdk_rdev_t *rdev; mdk_rdev_t *rdev;
struct list_head *tmp; struct list_head *tmp;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (rdev->sb_events == mddev->events || if (rdev->sb_events == mddev->events ||
(nospares && (nospares &&
rdev->raid_disk < 0 && rdev->raid_disk < 0 &&
...@@ -1730,7 +1730,7 @@ static void md_update_sb(mddev_t * mddev, int force_change) ...@@ -1730,7 +1730,7 @@ static void md_update_sb(mddev_t * mddev, int force_change)
mdname(mddev),mddev->in_sync); mdname(mddev),mddev->in_sync);
bitmap_update_sb(mddev->bitmap); bitmap_update_sb(mddev->bitmap);
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
dprintk(KERN_INFO "md: "); dprintk(KERN_INFO "md: ");
if (rdev->sb_loaded != 1) if (rdev->sb_loaded != 1)
...@@ -2016,7 +2016,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) ...@@ -2016,7 +2016,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
mdk_rdev_t *rdev2; mdk_rdev_t *rdev2;
mddev_lock(mddev); mddev_lock(mddev);
ITERATE_RDEV(mddev, rdev2, tmp2) rdev_for_each(rdev2, tmp2, mddev)
if (test_bit(AllReserved, &rdev2->flags) || if (test_bit(AllReserved, &rdev2->flags) ||
(rdev->bdev == rdev2->bdev && (rdev->bdev == rdev2->bdev &&
rdev != rdev2 && rdev != rdev2 &&
...@@ -2202,7 +2202,7 @@ static void analyze_sbs(mddev_t * mddev) ...@@ -2202,7 +2202,7 @@ static void analyze_sbs(mddev_t * mddev)
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
freshest = NULL; freshest = NULL;
ITERATE_RDEV(mddev,rdev,tmp) rdev_for_each(rdev, tmp, mddev)
switch (super_types[mddev->major_version]. switch (super_types[mddev->major_version].
load_super(rdev, freshest, mddev->minor_version)) { load_super(rdev, freshest, mddev->minor_version)) {
case 1: case 1:
...@@ -2223,7 +2223,7 @@ static void analyze_sbs(mddev_t * mddev) ...@@ -2223,7 +2223,7 @@ static void analyze_sbs(mddev_t * mddev)
validate_super(mddev, freshest); validate_super(mddev, freshest);
i = 0; i = 0;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (rdev != freshest) if (rdev != freshest)
if (super_types[mddev->major_version]. if (super_types[mddev->major_version].
validate_super(mddev, rdev)) { validate_super(mddev, rdev)) {
...@@ -3317,7 +3317,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -3317,7 +3317,7 @@ static int do_md_run(mddev_t * mddev)
} }
/* devices must have minimum size of one chunk */ /* devices must have minimum size of one chunk */
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (test_bit(Faulty, &rdev->flags)) if (test_bit(Faulty, &rdev->flags))
continue; continue;
if (rdev->size < chunk_size / 1024) { if (rdev->size < chunk_size / 1024) {
...@@ -3344,7 +3344,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -3344,7 +3344,7 @@ static int do_md_run(mddev_t * mddev)
* the only valid external interface is through the md * the only valid external interface is through the md
* device. * device.
*/ */
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
if (test_bit(Faulty, &rdev->flags)) if (test_bit(Faulty, &rdev->flags))
continue; continue;
sync_blockdev(rdev->bdev); sync_blockdev(rdev->bdev);
...@@ -3410,8 +3410,8 @@ static int do_md_run(mddev_t * mddev) ...@@ -3410,8 +3410,8 @@ static int do_md_run(mddev_t * mddev)
mdk_rdev_t *rdev2; mdk_rdev_t *rdev2;
struct list_head *tmp2; struct list_head *tmp2;
int warned = 0; int warned = 0;
ITERATE_RDEV(mddev, rdev, tmp) { rdev_for_each(rdev, tmp, mddev) {
ITERATE_RDEV(mddev, rdev2, tmp2) { rdev_for_each(rdev2, tmp2, mddev) {
if (rdev < rdev2 && if (rdev < rdev2 &&
rdev->bdev->bd_contains == rdev->bdev->bd_contains ==
rdev2->bdev->bd_contains) { rdev2->bdev->bd_contains) {
...@@ -3471,7 +3471,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -3471,7 +3471,7 @@ static int do_md_run(mddev_t * mddev)
mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */ mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */
mddev->in_sync = 1; mddev->in_sync = 1;
ITERATE_RDEV(mddev,rdev,tmp) rdev_for_each(rdev, tmp, mddev)
if (rdev->raid_disk >= 0) { if (rdev->raid_disk >= 0) {
char nm[20]; char nm[20];
sprintf(nm, "rd%d", rdev->raid_disk); sprintf(nm, "rd%d", rdev->raid_disk);
...@@ -3504,7 +3504,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -3504,7 +3504,7 @@ static int do_md_run(mddev_t * mddev)
if (mddev->degraded && !mddev->sync_thread) { if (mddev->degraded && !mddev->sync_thread) {
struct list_head *rtmp; struct list_head *rtmp;
int spares = 0; int spares = 0;
ITERATE_RDEV(mddev,rdev,rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk >= 0 && if (rdev->raid_disk >= 0 &&
!test_bit(In_sync, &rdev->flags) && !test_bit(In_sync, &rdev->flags) &&
!test_bit(Faulty, &rdev->flags)) !test_bit(Faulty, &rdev->flags))
...@@ -3681,7 +3681,7 @@ static int do_md_stop(mddev_t * mddev, int mode) ...@@ -3681,7 +3681,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
} }
mddev->bitmap_offset = 0; mddev->bitmap_offset = 0;
ITERATE_RDEV(mddev,rdev,tmp) rdev_for_each(rdev, tmp, mddev)
if (rdev->raid_disk >= 0) { if (rdev->raid_disk >= 0) {
char nm[20]; char nm[20];
sprintf(nm, "rd%d", rdev->raid_disk); sprintf(nm, "rd%d", rdev->raid_disk);
...@@ -3723,7 +3723,7 @@ static void autorun_array(mddev_t *mddev) ...@@ -3723,7 +3723,7 @@ static void autorun_array(mddev_t *mddev)
printk(KERN_INFO "md: running: "); printk(KERN_INFO "md: running: ");
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk("<%s>", bdevname(rdev->bdev,b)); printk("<%s>", bdevname(rdev->bdev,b));
} }
...@@ -3851,7 +3851,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg) ...@@ -3851,7 +3851,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg)
struct list_head *tmp; struct list_head *tmp;
nr=working=active=failed=spare=0; nr=working=active=failed=spare=0;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
nr++; nr++;
if (test_bit(Faulty, &rdev->flags)) if (test_bit(Faulty, &rdev->flags))
failed++; failed++;
...@@ -4391,7 +4391,7 @@ static int update_size(mddev_t *mddev, unsigned long size) ...@@ -4391,7 +4391,7 @@ static int update_size(mddev_t *mddev, unsigned long size)
*/ */
if (mddev->sync_thread) if (mddev->sync_thread)
return -EBUSY; return -EBUSY;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
sector_t avail; sector_t avail;
avail = rdev->size * 2; avail = rdev->size * 2;
...@@ -5132,7 +5132,7 @@ static int md_seq_show(struct seq_file *seq, void *v) ...@@ -5132,7 +5132,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
} }
size = 0; size = 0;
ITERATE_RDEV(mddev,rdev,tmp2) { rdev_for_each(rdev, tmp2, mddev) {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
seq_printf(seq, " %s[%d]", seq_printf(seq, " %s[%d]",
bdevname(rdev->bdev,b), rdev->desc_nr); bdevname(rdev->bdev,b), rdev->desc_nr);
...@@ -5288,7 +5288,7 @@ static int is_mddev_idle(mddev_t *mddev) ...@@ -5288,7 +5288,7 @@ static int is_mddev_idle(mddev_t *mddev)
long curr_events; long curr_events;
idle = 1; idle = 1;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; struct gendisk *disk = rdev->bdev->bd_contains->bd_disk;
curr_events = disk_stat_read(disk, sectors[0]) + curr_events = disk_stat_read(disk, sectors[0]) +
disk_stat_read(disk, sectors[1]) - disk_stat_read(disk, sectors[1]) -
...@@ -5515,7 +5515,7 @@ void md_do_sync(mddev_t *mddev) ...@@ -5515,7 +5515,7 @@ void md_do_sync(mddev_t *mddev)
/* recovery follows the physical size of devices */ /* recovery follows the physical size of devices */
max_sectors = mddev->size << 1; max_sectors = mddev->size << 1;
j = MaxSector; j = MaxSector;
ITERATE_RDEV(mddev,rdev,rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk >= 0 && if (rdev->raid_disk >= 0 &&
!test_bit(Faulty, &rdev->flags) && !test_bit(Faulty, &rdev->flags) &&
!test_bit(In_sync, &rdev->flags) && !test_bit(In_sync, &rdev->flags) &&
...@@ -5668,7 +5668,7 @@ void md_do_sync(mddev_t *mddev) ...@@ -5668,7 +5668,7 @@ void md_do_sync(mddev_t *mddev)
} else { } else {
if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery))
mddev->curr_resync = MaxSector; mddev->curr_resync = MaxSector;
ITERATE_RDEV(mddev,rdev,rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk >= 0 && if (rdev->raid_disk >= 0 &&
!test_bit(Faulty, &rdev->flags) && !test_bit(Faulty, &rdev->flags) &&
!test_bit(In_sync, &rdev->flags) && !test_bit(In_sync, &rdev->flags) &&
...@@ -5706,7 +5706,7 @@ static int remove_and_add_spares(mddev_t *mddev) ...@@ -5706,7 +5706,7 @@ static int remove_and_add_spares(mddev_t *mddev)
struct list_head *rtmp; struct list_head *rtmp;
int spares = 0; int spares = 0;
ITERATE_RDEV(mddev,rdev,rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk >= 0 && if (rdev->raid_disk >= 0 &&
!mddev->external && !mddev->external &&
(test_bit(Faulty, &rdev->flags) || (test_bit(Faulty, &rdev->flags) ||
...@@ -5722,7 +5722,7 @@ static int remove_and_add_spares(mddev_t *mddev) ...@@ -5722,7 +5722,7 @@ static int remove_and_add_spares(mddev_t *mddev)
} }
if (mddev->degraded) { if (mddev->degraded) {
ITERATE_RDEV(mddev,rdev,rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk < 0 if (rdev->raid_disk < 0
&& !test_bit(Faulty, &rdev->flags)) { && !test_bit(Faulty, &rdev->flags)) {
rdev->recovery_offset = 0; rdev->recovery_offset = 0;
...@@ -5836,7 +5836,7 @@ void md_check_recovery(mddev_t *mddev) ...@@ -5836,7 +5836,7 @@ void md_check_recovery(mddev_t *mddev)
* information must be scrapped * information must be scrapped
*/ */
if (!mddev->degraded) if (!mddev->degraded)
ITERATE_RDEV(mddev,rdev,rtmp) rdev_for_each(rdev, rtmp, mddev)
rdev->saved_raid_disk = -1; rdev->saved_raid_disk = -1;
mddev->recovery = 0; mddev->recovery = 0;
......
...@@ -436,7 +436,7 @@ static int multipath_run (mddev_t *mddev) ...@@ -436,7 +436,7 @@ static int multipath_run (mddev_t *mddev)
} }
conf->working_disks = 0; conf->working_disks = 0;
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
disk_idx = rdev->raid_disk; disk_idx = rdev->raid_disk;
if (disk_idx < 0 || if (disk_idx < 0 ||
disk_idx >= mddev->raid_disks) disk_idx >= mddev->raid_disks)
......
...@@ -72,11 +72,11 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -72,11 +72,11 @@ static int create_strip_zones (mddev_t *mddev)
*/ */
conf->nr_strip_zones = 0; conf->nr_strip_zones = 0;
ITERATE_RDEV(mddev,rdev1,tmp1) { rdev_for_each(rdev1, tmp1, mddev) {
printk("raid0: looking at %s\n", printk("raid0: looking at %s\n",
bdevname(rdev1->bdev,b)); bdevname(rdev1->bdev,b));
c = 0; c = 0;
ITERATE_RDEV(mddev,rdev2,tmp2) { rdev_for_each(rdev2, tmp2, mddev) {
printk("raid0: comparing %s(%llu)", printk("raid0: comparing %s(%llu)",
bdevname(rdev1->bdev,b), bdevname(rdev1->bdev,b),
(unsigned long long)rdev1->size); (unsigned long long)rdev1->size);
...@@ -124,7 +124,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -124,7 +124,7 @@ static int create_strip_zones (mddev_t *mddev)
cnt = 0; cnt = 0;
smallest = NULL; smallest = NULL;
zone->dev = conf->devlist; zone->dev = conf->devlist;
ITERATE_RDEV(mddev, rdev1, tmp1) { rdev_for_each(rdev1, tmp1, mddev) {
int j = rdev1->raid_disk; int j = rdev1->raid_disk;
if (j < 0 || j >= mddev->raid_disks) { if (j < 0 || j >= mddev->raid_disks) {
...@@ -293,7 +293,7 @@ static int raid0_run (mddev_t *mddev) ...@@ -293,7 +293,7 @@ static int raid0_run (mddev_t *mddev)
/* calculate array device size */ /* calculate array device size */
mddev->array_size = 0; mddev->array_size = 0;
ITERATE_RDEV(mddev,rdev,tmp) rdev_for_each(rdev, tmp, mddev)
mddev->array_size += rdev->size; mddev->array_size += rdev->size;
printk("raid0 : md_size is %llu blocks.\n", printk("raid0 : md_size is %llu blocks.\n",
......
...@@ -1887,7 +1887,7 @@ static int run(mddev_t *mddev) ...@@ -1887,7 +1887,7 @@ static int run(mddev_t *mddev)
if (!conf->r1bio_pool) if (!conf->r1bio_pool)
goto out_no_mem; goto out_no_mem;
ITERATE_RDEV(mddev, rdev, tmp) { rdev_for_each(rdev, tmp, mddev) {
disk_idx = rdev->raid_disk; disk_idx = rdev->raid_disk;
if (disk_idx >= mddev->raid_disks if (disk_idx >= mddev->raid_disks
|| disk_idx < 0) || disk_idx < 0)
......
...@@ -2026,7 +2026,7 @@ static int run(mddev_t *mddev) ...@@ -2026,7 +2026,7 @@ static int run(mddev_t *mddev)
goto out_free_conf; goto out_free_conf;
} }
ITERATE_RDEV(mddev, rdev, tmp) { rdev_for_each(rdev, tmp, mddev) {
disk_idx = rdev->raid_disk; disk_idx = rdev->raid_disk;
if (disk_idx >= mddev->raid_disks if (disk_idx >= mddev->raid_disks
|| disk_idx < 0) || disk_idx < 0)
......
...@@ -4136,7 +4136,7 @@ static int run(mddev_t *mddev) ...@@ -4136,7 +4136,7 @@ static int run(mddev_t *mddev)
pr_debug("raid5: run(%s) called.\n", mdname(mddev)); pr_debug("raid5: run(%s) called.\n", mdname(mddev));
ITERATE_RDEV(mddev,rdev,tmp) { rdev_for_each(rdev, tmp, mddev) {
raid_disk = rdev->raid_disk; raid_disk = rdev->raid_disk;
if (raid_disk >= conf->raid_disks if (raid_disk >= conf->raid_disks
|| raid_disk < 0) || raid_disk < 0)
...@@ -4549,7 +4549,7 @@ static int raid5_start_reshape(mddev_t *mddev) ...@@ -4549,7 +4549,7 @@ static int raid5_start_reshape(mddev_t *mddev)
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
return -EBUSY; return -EBUSY;
ITERATE_RDEV(mddev, rdev, rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk < 0 && if (rdev->raid_disk < 0 &&
!test_bit(Faulty, &rdev->flags)) !test_bit(Faulty, &rdev->flags))
spares++; spares++;
...@@ -4571,7 +4571,7 @@ static int raid5_start_reshape(mddev_t *mddev) ...@@ -4571,7 +4571,7 @@ static int raid5_start_reshape(mddev_t *mddev)
/* Add some new drives, as many as will fit. /* Add some new drives, as many as will fit.
* We know there are enough to make the newly sized array work. * We know there are enough to make the newly sized array work.
*/ */
ITERATE_RDEV(mddev, rdev, rtmp) rdev_for_each(rdev, rtmp, mddev)
if (rdev->raid_disk < 0 && if (rdev->raid_disk < 0 &&
!test_bit(Faulty, &rdev->flags)) { !test_bit(Faulty, &rdev->flags)) {
if (raid5_add_disk(mddev, rdev)) { if (raid5_add_disk(mddev, rdev)) {
......
...@@ -322,7 +322,7 @@ static inline char * mdname (mddev_t * mddev) ...@@ -322,7 +322,7 @@ static inline char * mdname (mddev_t * mddev)
/* /*
* iterates through the 'same array disks' ringlist * iterates through the 'same array disks' ringlist
*/ */
#define ITERATE_RDEV(mddev,rdev,tmp) \ #define rdev_for_each(rdev, tmp, mddev) \
ITERATE_RDEV_GENERIC((mddev)->disks,rdev,tmp) ITERATE_RDEV_GENERIC((mddev)->disks,rdev,tmp)
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment