Commit ca995ff7 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: Store rdev instead of bdev in per-personality status arrays

Holding the rdev instead of the bdev does cause an extra
de-reference, but it is conceptually cleaner and will allow
lots more tidying up.
parent 97560787
...@@ -55,12 +55,12 @@ static int linear_run (mddev_t *mddev) ...@@ -55,12 +55,12 @@ static int linear_run (mddev_t *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;
if (j < 0 || j > mddev->raid_disks || disk->bdev) { if (j < 0 || j > mddev->raid_disks || disk->rdev) {
printk("linear: disk numbering problem. Aborting!\n"); printk("linear: disk numbering problem. Aborting!\n");
goto out; goto out;
} }
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->size = rdev->size; disk->size = rdev->size;
if (!conf->smallest || (disk->size < conf->smallest->size)) if (!conf->smallest || (disk->size < conf->smallest->size))
...@@ -153,11 +153,11 @@ static int linear_make_request (request_queue_t *q, struct bio *bio) ...@@ -153,11 +153,11 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
if (block >= (tmp_dev->size + tmp_dev->offset) if (block >= (tmp_dev->size + tmp_dev->offset)
|| block < tmp_dev->offset) { || block < tmp_dev->offset) {
printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, bdevname(tmp_dev->bdev), tmp_dev->size, tmp_dev->offset); printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, bdevname(tmp_dev->rdev->bdev), tmp_dev->size, tmp_dev->offset);
bio_io_error(bio); bio_io_error(bio);
return 0; return 0;
} }
bio->bi_bdev = tmp_dev->bdev; bio->bi_bdev = tmp_dev->rdev->bdev;
bio->bi_sector = bio->bi_sector - (tmp_dev->offset << 1); bio->bi_sector = bio->bi_sector - (tmp_dev->offset << 1);
return 1; return 1;
...@@ -176,11 +176,11 @@ static int linear_status (char *page, mddev_t *mddev) ...@@ -176,11 +176,11 @@ static int linear_status (char *page, mddev_t *mddev)
for (j = 0; j < conf->nr_zones; j++) for (j = 0; j < conf->nr_zones; j++)
{ {
sz += sprintf(page+sz, "[%s", sz += sprintf(page+sz, "[%s",
bdev_partition_name(conf->hash_table[j].dev0->bdev)); bdev_partition_name(conf->hash_table[j].dev0->rdev->bdev));
if (conf->hash_table[j].dev1) if (conf->hash_table[j].dev1)
sz += sprintf(page+sz, "/%s] ", sz += sprintf(page+sz, "/%s] ",
bdev_partition_name(conf->hash_table[j].dev1->bdev)); bdev_partition_name(conf->hash_table[j].dev1->rdev->bdev));
else else
sz += sprintf(page+sz, "] "); sz += sprintf(page+sz, "] ");
} }
......
...@@ -82,7 +82,7 @@ static int multipath_map (mddev_t *mddev, struct block_device **bdev) ...@@ -82,7 +82,7 @@ static int multipath_map (mddev_t *mddev, struct block_device **bdev)
for (i = 0; i < disks; i++) { for (i = 0; i < disks; i++) {
if (conf->multipaths[i].operational) { if (conf->multipaths[i].operational) {
*bdev = conf->multipaths[i].bdev; *bdev = conf->multipaths[i].rdev->bdev;
return (0); return (0);
} }
} }
...@@ -136,7 +136,7 @@ void multipath_end_request(struct bio *bio) ...@@ -136,7 +136,7 @@ void multipath_end_request(struct bio *bio)
* oops, IO error: * oops, IO error:
*/ */
conf = mddev_to_conf(mp_bh->mddev); conf = mddev_to_conf(mp_bh->mddev);
bdev = conf->multipaths[mp_bh->path].bdev; bdev = conf->multipaths[mp_bh->path].rdev->bdev;
md_error (mp_bh->mddev, bdev); md_error (mp_bh->mddev, bdev);
printk(KERN_ERR "multipath: %s: rescheduling sector %lu\n", printk(KERN_ERR "multipath: %s: rescheduling sector %lu\n",
bdev_partition_name(bdev), bio->bi_sector); bdev_partition_name(bdev), bio->bi_sector);
...@@ -179,7 +179,7 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio) ...@@ -179,7 +179,7 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio)
multipath = conf->multipaths + mp_bh->path; multipath = conf->multipaths + mp_bh->path;
mp_bh->bio = *bio; mp_bh->bio = *bio;
mp_bh->bio.bi_bdev = multipath->bdev; mp_bh->bio.bi_bdev = multipath->rdev->bdev;
mp_bh->bio.bi_end_io = multipath_end_request; mp_bh->bio.bi_end_io = multipath_end_request;
mp_bh->bio.bi_private = mp_bh; mp_bh->bio.bi_private = mp_bh;
generic_make_request(&mp_bh->bio); generic_make_request(&mp_bh->bio);
...@@ -218,7 +218,7 @@ static void mark_disk_bad (mddev_t *mddev, int failed) ...@@ -218,7 +218,7 @@ static void mark_disk_bad (mddev_t *mddev, int failed)
multipath->operational = 0; multipath->operational = 0;
mddev->sb_dirty = 1; mddev->sb_dirty = 1;
conf->working_disks--; conf->working_disks--;
printk (DISK_FAILED, bdev_partition_name (multipath->bdev), printk (DISK_FAILED, bdev_partition_name (multipath->rdev->bdev),
conf->working_disks); conf->working_disks);
} }
...@@ -240,7 +240,7 @@ static int multipath_error (mddev_t *mddev, struct block_device *bdev) ...@@ -240,7 +240,7 @@ static int multipath_error (mddev_t *mddev, struct block_device *bdev)
* which has just failed. * which has just failed.
*/ */
for (i = 0; i < disks; i++) { for (i = 0; i < disks; i++) {
if (multipaths[i].bdev == bdev && !multipaths[i].operational) if (multipaths[i].rdev->bdev == bdev && !multipaths[i].operational)
return 0; return 0;
} }
printk (LAST_DISK); printk (LAST_DISK);
...@@ -250,7 +250,7 @@ static int multipath_error (mddev_t *mddev, struct block_device *bdev) ...@@ -250,7 +250,7 @@ static int multipath_error (mddev_t *mddev, struct block_device *bdev)
* Mark disk as unusable * Mark disk as unusable
*/ */
for (i = 0; i < disks; i++) { for (i = 0; i < disks; i++) {
if (multipaths[i].bdev == bdev && multipaths[i].operational) { if (multipaths[i].rdev->bdev == bdev && multipaths[i].operational) {
mark_disk_bad(mddev, i); mark_disk_bad(mddev, i);
break; break;
} }
...@@ -283,7 +283,7 @@ static void print_multipath_conf (multipath_conf_t *conf) ...@@ -283,7 +283,7 @@ static void print_multipath_conf (multipath_conf_t *conf)
printk(" disk%d, o:%d, us:%d dev:%s\n", printk(" disk%d, o:%d, us:%d dev:%s\n",
i,tmp->operational, i,tmp->operational,
tmp->used_slot, tmp->used_slot,
bdev_partition_name(tmp->bdev)); bdev_partition_name(tmp->rdev->bdev));
} }
} }
...@@ -297,7 +297,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) ...@@ -297,7 +297,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
print_multipath_conf(conf); print_multipath_conf(conf);
spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock);
if (!p->used_slot) { if (!p->used_slot) {
p->bdev = rdev->bdev; p->rdev = rdev;
p->operational = 1; p->operational = 1;
p->used_slot = 1; p->used_slot = 1;
conf->working_disks++; conf->working_disks++;
...@@ -326,7 +326,7 @@ static int multipath_remove_disk(mddev_t *mddev, int number) ...@@ -326,7 +326,7 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
err = -EBUSY; err = -EBUSY;
goto abort; goto abort;
} }
p->bdev = NULL; p->rdev = NULL;
p->used_slot = 0; p->used_slot = 0;
err = 0; err = 0;
} }
...@@ -485,7 +485,7 @@ static int multipath_run (mddev_t *mddev) ...@@ -485,7 +485,7 @@ static int multipath_run (mddev_t *mddev)
* spares. multipath_read_balance deals with choose * spares. multipath_read_balance deals with choose
* the "best" operational device. * the "best" operational device.
*/ */
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 1; disk->operational = 1;
disk->used_slot = 1; disk->used_slot = 1;
num_rdevs++; num_rdevs++;
......
...@@ -200,7 +200,7 @@ static int map(mddev_t *mddev, struct block_device **bdev) ...@@ -200,7 +200,7 @@ static int map(mddev_t *mddev, struct block_device **bdev)
for (i = 0; i < disks; i++) { for (i = 0; i < disks; i++) {
if (conf->mirrors[i].operational) { if (conf->mirrors[i].operational) {
*bdev = conf->mirrors[i].bdev; *bdev = conf->mirrors[i].rdev->bdev;
return 0; return 0;
} }
} }
...@@ -265,7 +265,7 @@ static void end_request(struct bio *bio) ...@@ -265,7 +265,7 @@ static void end_request(struct bio *bio)
* this branch is our 'one mirror IO has finished' event handler: * this branch is our 'one mirror IO has finished' event handler:
*/ */
if (!uptodate) if (!uptodate)
md_error(r1_bio->mddev, conf->mirrors[mirror].bdev); md_error(r1_bio->mddev, conf->mirrors[mirror].rdev->bdev);
else else
/* /*
* Set R1BIO_Uptodate in our master bio, so that * Set R1BIO_Uptodate in our master bio, so that
...@@ -293,7 +293,7 @@ static void end_request(struct bio *bio) ...@@ -293,7 +293,7 @@ static void end_request(struct bio *bio)
* oops, read error: * oops, read error:
*/ */
printk(KERN_ERR "raid1: %s: rescheduling sector %lu\n", printk(KERN_ERR "raid1: %s: rescheduling sector %lu\n",
bdev_partition_name(conf->mirrors[mirror].bdev), r1_bio->sector); bdev_partition_name(conf->mirrors[mirror].rdev->bdev), r1_bio->sector);
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
return; return;
} }
...@@ -478,7 +478,7 @@ static int make_request(request_queue_t *q, struct bio * bio) ...@@ -478,7 +478,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
r1_bio->read_bio = read_bio; r1_bio->read_bio = read_bio;
read_bio->bi_sector = r1_bio->sector; read_bio->bi_sector = r1_bio->sector;
read_bio->bi_bdev = mirror->bdev; read_bio->bi_bdev = mirror->rdev->bdev;
read_bio->bi_end_io = end_request; read_bio->bi_end_io = end_request;
read_bio->bi_rw = r1_bio->cmd; read_bio->bi_rw = r1_bio->cmd;
read_bio->bi_private = r1_bio; read_bio->bi_private = r1_bio;
...@@ -502,7 +502,7 @@ static int make_request(request_queue_t *q, struct bio * bio) ...@@ -502,7 +502,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
r1_bio->write_bios[i] = mbio; r1_bio->write_bios[i] = mbio;
mbio->bi_sector = r1_bio->sector; mbio->bi_sector = r1_bio->sector;
mbio->bi_bdev = conf->mirrors[i].bdev; mbio->bi_bdev = conf->mirrors[i].rdev->bdev;
mbio->bi_end_io = end_request; mbio->bi_end_io = end_request;
mbio->bi_rw = r1_bio->cmd; mbio->bi_rw = r1_bio->cmd;
mbio->bi_private = r1_bio; mbio->bi_private = r1_bio;
...@@ -582,7 +582,7 @@ static void mark_disk_bad(mddev_t *mddev, int failed) ...@@ -582,7 +582,7 @@ static void mark_disk_bad(mddev_t *mddev, int failed)
conf->working_disks--; conf->working_disks--;
} }
mddev->sb_dirty = 1; mddev->sb_dirty = 1;
printk(DISK_FAILED, bdev_partition_name(mirror->bdev), conf->working_disks); printk(DISK_FAILED, bdev_partition_name(mirror->rdev->bdev), conf->working_disks);
} }
static int error(mddev_t *mddev, struct block_device *bdev) static int error(mddev_t *mddev, struct block_device *bdev)
...@@ -600,7 +600,7 @@ static int error(mddev_t *mddev, struct block_device *bdev) ...@@ -600,7 +600,7 @@ static int error(mddev_t *mddev, struct block_device *bdev)
* else mark the drive as failed * else mark the drive as failed
*/ */
for (i = 0; i < disks; i++) for (i = 0; i < disks; i++)
if (mirrors[i].bdev == bdev && mirrors[i].operational) if (mirrors[i].operational && mirrors[i].rdev->bdev == bdev)
break; break;
if (i == disks) if (i == disks)
return 0; return 0;
...@@ -633,7 +633,7 @@ static void print_conf(conf_t *conf) ...@@ -633,7 +633,7 @@ static void print_conf(conf_t *conf)
printk(" disk %d, s:%d, o:%d, us:%d dev:%s\n", printk(" disk %d, s:%d, o:%d, us:%d dev:%s\n",
i, tmp->spare, tmp->operational, i, tmp->spare, tmp->operational,
tmp->used_slot, tmp->used_slot,
bdev_partition_name(tmp->bdev)); bdev_partition_name(tmp->rdev->bdev));
} }
} }
...@@ -718,7 +718,7 @@ static int raid1_spare_active(mddev_t *mddev) ...@@ -718,7 +718,7 @@ static int raid1_spare_active(mddev_t *mddev)
* disk. (this means we switch back these values) * disk. (this means we switch back these values)
*/ */
if (!sdisk->bdev) if (!sdisk->rdev)
sdisk->used_slot = 0; sdisk->used_slot = 0;
/* /*
* this really activates the spare. * this really activates the spare.
...@@ -792,8 +792,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) ...@@ -792,8 +792,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
print_conf(conf); print_conf(conf);
spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock);
if (!p->used_slot) { if (!p->used_slot) {
/* it will be held open by rdev */ p->rdev = rdev;
p->bdev = rdev->bdev;
p->operational = 0; p->operational = 0;
p->write_only = 0; p->write_only = 0;
p->spare = 1; p->spare = 1;
...@@ -822,7 +821,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number) ...@@ -822,7 +821,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
err = -EBUSY; err = -EBUSY;
goto abort; goto abort;
} }
p->bdev = NULL; p->rdev = NULL;
p->used_slot = 0; p->used_slot = 0;
err = 0; err = 0;
} }
...@@ -857,7 +856,7 @@ static void end_sync_read(struct bio *bio) ...@@ -857,7 +856,7 @@ static void end_sync_read(struct bio *bio)
*/ */
if (!uptodate) if (!uptodate)
md_error(r1_bio->mddev, md_error(r1_bio->mddev,
conf->mirrors[r1_bio->read_disk].bdev); conf->mirrors[r1_bio->read_disk].rdev->bdev);
else else
set_bit(R1BIO_Uptodate, &r1_bio->state); set_bit(R1BIO_Uptodate, &r1_bio->state);
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
...@@ -878,7 +877,7 @@ static void end_sync_write(struct bio *bio) ...@@ -878,7 +877,7 @@ static void end_sync_write(struct bio *bio)
break; break;
} }
if (!uptodate) if (!uptodate)
md_error(mddev, conf->mirrors[mirror].bdev); md_error(mddev, conf->mirrors[mirror].rdev->bdev);
update_head_pos(mirror, r1_bio); update_head_pos(mirror, r1_bio);
if (atomic_dec_and_test(&r1_bio->remaining)) { if (atomic_dec_and_test(&r1_bio->remaining)) {
...@@ -931,7 +930,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) ...@@ -931,7 +930,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
if (r1_bio->write_bios[i]) if (r1_bio->write_bios[i])
BUG(); BUG();
r1_bio->write_bios[i] = mbio; r1_bio->write_bios[i] = mbio;
mbio->bi_bdev = conf->mirrors[i].bdev; mbio->bi_bdev = conf->mirrors[i].rdev->bdev;
mbio->bi_sector = r1_bio->sector; mbio->bi_sector = r1_bio->sector;
mbio->bi_end_io = end_sync_write; mbio->bi_end_io = end_sync_write;
mbio->bi_rw = WRITE; mbio->bi_rw = WRITE;
...@@ -1119,7 +1118,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) ...@@ -1119,7 +1118,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
read_bio = bio_clone(r1_bio->master_bio, GFP_NOIO); read_bio = bio_clone(r1_bio->master_bio, GFP_NOIO);
read_bio->bi_sector = sector_nr; read_bio->bi_sector = sector_nr;
read_bio->bi_bdev = mirror->bdev; read_bio->bi_bdev = mirror->rdev->bdev;
read_bio->bi_end_io = end_sync_read; read_bio->bi_end_io = end_sync_read;
read_bio->bi_rw = READ; read_bio->bi_rw = READ;
read_bio->bi_private = r1_bio; read_bio->bi_private = r1_bio;
...@@ -1228,7 +1227,7 @@ static int run(mddev_t *mddev) ...@@ -1228,7 +1227,7 @@ static int run(mddev_t *mddev)
disk = conf->mirrors + disk_idx; disk = conf->mirrors + disk_idx;
if (rdev->faulty) { if (rdev->faulty) {
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 0; disk->operational = 0;
disk->write_only = 0; disk->write_only = 0;
disk->spare = 0; disk->spare = 0;
...@@ -1245,7 +1244,7 @@ static int run(mddev_t *mddev) ...@@ -1245,7 +1244,7 @@ static int run(mddev_t *mddev)
} }
printk(OPERATIONAL, bdev_partition_name(rdev->bdev), printk(OPERATIONAL, bdev_partition_name(rdev->bdev),
disk_idx); disk_idx);
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 1; disk->operational = 1;
disk->write_only = 0; disk->write_only = 0;
disk->spare = 0; disk->spare = 0;
...@@ -1257,7 +1256,7 @@ static int run(mddev_t *mddev) ...@@ -1257,7 +1256,7 @@ static int run(mddev_t *mddev)
* Must be a spare disk .. * Must be a spare disk ..
*/ */
printk(SPARE, bdev_partition_name(rdev->bdev)); printk(SPARE, bdev_partition_name(rdev->bdev));
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 0; disk->operational = 0;
disk->write_only = 0; disk->write_only = 0;
disk->spare = 1; disk->spare = 1;
...@@ -1284,7 +1283,7 @@ static int run(mddev_t *mddev) ...@@ -1284,7 +1283,7 @@ static int run(mddev_t *mddev)
disk = conf->mirrors + i; disk = conf->mirrors + i;
if (!disk->used_slot) { if (!disk->used_slot) {
disk->bdev = NULL; disk->rdev = NULL;
disk->operational = 0; disk->operational = 0;
disk->write_only = 0; disk->write_only = 0;
disk->spare = 0; disk->spare = 0;
......
...@@ -371,7 +371,7 @@ static void raid5_end_read_request (struct bio * bi) ...@@ -371,7 +371,7 @@ static void raid5_end_read_request (struct bio * bi)
set_bit(R5_UPTODATE, &sh->dev[i].flags); set_bit(R5_UPTODATE, &sh->dev[i].flags);
#endif #endif
} else { } else {
md_error(conf->mddev, conf->disks[i].bdev); md_error(conf->mddev, conf->disks[i].rdev->bdev);
clear_bit(R5_UPTODATE, &sh->dev[i].flags); clear_bit(R5_UPTODATE, &sh->dev[i].flags);
} }
#if 0 #if 0
...@@ -407,7 +407,7 @@ static void raid5_end_write_request (struct bio *bi) ...@@ -407,7 +407,7 @@ static void raid5_end_write_request (struct bio *bi)
spin_lock_irqsave(&conf->device_lock, flags); spin_lock_irqsave(&conf->device_lock, flags);
if (!uptodate) if (!uptodate)
md_error(conf->mddev, conf->disks[i].bdev); md_error(conf->mddev, conf->disks[i].rdev->bdev);
clear_bit(R5_LOCKED, &sh->dev[i].flags); clear_bit(R5_LOCKED, &sh->dev[i].flags);
set_bit(STRIPE_HANDLE, &sh->state); set_bit(STRIPE_HANDLE, &sh->state);
...@@ -420,7 +420,6 @@ static unsigned long compute_blocknr(struct stripe_head *sh, int i); ...@@ -420,7 +420,6 @@ static unsigned long compute_blocknr(struct stripe_head *sh, int i);
static void raid5_build_block (struct stripe_head *sh, int i) static void raid5_build_block (struct stripe_head *sh, int i)
{ {
raid5_conf_t *conf = sh->raid_conf;
struct r5dev *dev = &sh->dev[i]; struct r5dev *dev = &sh->dev[i];
bio_init(&dev->req); bio_init(&dev->req);
...@@ -430,7 +429,6 @@ static void raid5_build_block (struct stripe_head *sh, int i) ...@@ -430,7 +429,6 @@ static void raid5_build_block (struct stripe_head *sh, int i)
dev->vec.bv_len = STRIPE_SIZE; dev->vec.bv_len = STRIPE_SIZE;
dev->vec.bv_offset = 0; dev->vec.bv_offset = 0;
dev->req.bi_bdev = conf->disks[i].bdev;
dev->req.bi_sector = sh->sector; dev->req.bi_sector = sh->sector;
dev->req.bi_private = sh; dev->req.bi_private = sh;
...@@ -448,7 +446,7 @@ static int error(mddev_t *mddev, struct block_device *bdev) ...@@ -448,7 +446,7 @@ static int error(mddev_t *mddev, struct block_device *bdev)
PRINTK("raid5: error called\n"); PRINTK("raid5: error called\n");
for (i = 0, disk = conf->disks; i < conf->raid_disks; i++, disk++) { for (i = 0, disk = conf->disks; i < conf->raid_disks; i++, disk++) {
if (disk->bdev != bdev) if (disk->rdev->bdev != bdev)
continue; continue;
if (disk->operational) { if (disk->operational) {
disk->operational = 0; disk->operational = 0;
...@@ -468,7 +466,7 @@ static int error(mddev_t *mddev, struct block_device *bdev) ...@@ -468,7 +466,7 @@ static int error(mddev_t *mddev, struct block_device *bdev)
*/ */
if (conf->spare) { if (conf->spare) {
disk = conf->spare; disk = conf->spare;
if (disk->bdev == bdev) { if (disk->rdev->bdev == bdev) {
printk (KERN_ALERT printk (KERN_ALERT
"raid5: Disk failure on spare %s\n", "raid5: Disk failure on spare %s\n",
bdev_partition_name (bdev)); bdev_partition_name (bdev));
...@@ -1003,7 +1001,7 @@ static void handle_stripe(struct stripe_head *sh) ...@@ -1003,7 +1001,7 @@ static void handle_stripe(struct stripe_head *sh)
locked++; locked++;
PRINTK("Reading block %d (sync=%d)\n", i, syncing); PRINTK("Reading block %d (sync=%d)\n", i, syncing);
if (syncing) if (syncing)
md_sync_acct(conf->disks[i].bdev, STRIPE_SECTORS); md_sync_acct(conf->disks[i].rdev->bdev, STRIPE_SECTORS);
} }
} }
} }
...@@ -1142,9 +1140,9 @@ static void handle_stripe(struct stripe_head *sh) ...@@ -1142,9 +1140,9 @@ static void handle_stripe(struct stripe_head *sh)
locked++; locked++;
set_bit(STRIPE_INSYNC, &sh->state); set_bit(STRIPE_INSYNC, &sh->state);
if (conf->disks[failed_num].operational) if (conf->disks[failed_num].operational)
md_sync_acct(conf->disks[failed_num].bdev, STRIPE_SECTORS); md_sync_acct(conf->disks[failed_num].rdev->bdev, STRIPE_SECTORS);
else if ((spare=conf->spare)) else if ((spare=conf->spare))
md_sync_acct(spare->bdev, STRIPE_SECTORS); md_sync_acct(spare->rdev->bdev, STRIPE_SECTORS);
} }
} }
...@@ -1170,9 +1168,9 @@ static void handle_stripe(struct stripe_head *sh) ...@@ -1170,9 +1168,9 @@ static void handle_stripe(struct stripe_head *sh)
else else
bi->bi_end_io = raid5_end_write_request; bi->bi_end_io = raid5_end_write_request;
if (conf->disks[i].operational) if (conf->disks[i].operational)
bi->bi_bdev = conf->disks[i].bdev; bi->bi_bdev = conf->disks[i].rdev->bdev;
else if (spare && action[i] == WRITE+1) else if (spare && action[i] == WRITE+1)
bi->bi_bdev = spare->bdev; bi->bi_bdev = spare->rdev->bdev;
else skip=1; else skip=1;
if (!skip) { if (!skip) {
PRINTK("for %ld schedule op %d on disc %d\n", sh->sector, action[i]-1, i); PRINTK("for %ld schedule op %d on disc %d\n", sh->sector, action[i]-1, i);
...@@ -1409,7 +1407,7 @@ static int run (mddev_t *mddev) ...@@ -1409,7 +1407,7 @@ static int run (mddev_t *mddev)
if (rdev->faulty) { if (rdev->faulty) {
printk(KERN_ERR "raid5: disabled device %s (errors detected)\n", bdev_partition_name(rdev->bdev)); printk(KERN_ERR "raid5: disabled device %s (errors detected)\n", bdev_partition_name(rdev->bdev));
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 0; disk->operational = 0;
disk->write_only = 0; disk->write_only = 0;
...@@ -1424,7 +1422,7 @@ static int run (mddev_t *mddev) ...@@ -1424,7 +1422,7 @@ static int run (mddev_t *mddev)
} }
printk(KERN_INFO "raid5: device %s operational as raid disk %d\n", bdev_partition_name(rdev->bdev), raid_disk); printk(KERN_INFO "raid5: device %s operational as raid disk %d\n", bdev_partition_name(rdev->bdev), raid_disk);
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 1; disk->operational = 1;
disk->used_slot = 1; disk->used_slot = 1;
...@@ -1434,7 +1432,7 @@ static int run (mddev_t *mddev) ...@@ -1434,7 +1432,7 @@ static int run (mddev_t *mddev)
* Must be a spare disk .. * Must be a spare disk ..
*/ */
printk(KERN_INFO "raid5: spare disk %s\n", bdev_partition_name(rdev->bdev)); printk(KERN_INFO "raid5: spare disk %s\n", bdev_partition_name(rdev->bdev));
disk->bdev = rdev->bdev; disk->rdev = rdev;
disk->operational = 0; disk->operational = 0;
disk->write_only = 0; disk->write_only = 0;
...@@ -1447,7 +1445,7 @@ static int run (mddev_t *mddev) ...@@ -1447,7 +1445,7 @@ static int run (mddev_t *mddev)
disk = conf->disks + i; disk = conf->disks + i;
if (!disk->used_slot) { if (!disk->used_slot) {
disk->bdev = NULL; disk->rdev = NULL;
disk->operational = 0; disk->operational = 0;
disk->write_only = 0; disk->write_only = 0;
...@@ -1628,7 +1626,7 @@ static void print_raid5_conf (raid5_conf_t *conf) ...@@ -1628,7 +1626,7 @@ static void print_raid5_conf (raid5_conf_t *conf)
printk(" disk %d, s:%d, o:%d, us:%d dev:%s\n", printk(" disk %d, s:%d, o:%d, us:%d dev:%s\n",
i, tmp->spare,tmp->operational, i, tmp->spare,tmp->operational,
tmp->used_slot, tmp->used_slot,
bdev_partition_name(tmp->bdev)); bdev_partition_name(tmp->rdev->bdev));
} }
} }
...@@ -1695,7 +1693,7 @@ static int raid5_spare_active(mddev_t *mddev) ...@@ -1695,7 +1693,7 @@ static int raid5_spare_active(mddev_t *mddev)
* disk. (this means we switch back these values) * disk. (this means we switch back these values)
*/ */
if (!sdisk->bdev) if (!sdisk->rdev)
sdisk->used_slot = 0; sdisk->used_slot = 0;
/* /*
...@@ -1778,7 +1776,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number) ...@@ -1778,7 +1776,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number)
err = -EBUSY; err = -EBUSY;
goto abort; goto abort;
} }
p->bdev = NULL; p->rdev = NULL;
p->used_slot = 0; p->used_slot = 0;
err = 0; err = 0;
} }
...@@ -1804,7 +1802,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) ...@@ -1804,7 +1802,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
if (!p->used_slot) { if (!p->used_slot) {
/* it will be held open by rdev */ /* it will be held open by rdev */
p->bdev = rdev->bdev; p->rdev = rdev;
p->operational = 0; p->operational = 0;
p->write_only = 0; p->write_only = 0;
p->spare = 1; p->spare = 1;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <linux/raid/md.h> #include <linux/raid/md.h>
struct dev_info { struct dev_info {
struct block_device *bdev; mdk_rdev_t *rdev;
unsigned long size; unsigned long size;
unsigned long offset; unsigned long offset;
}; };
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <linux/bio.h> #include <linux/bio.h>
struct multipath_info { struct multipath_info {
struct block_device *bdev; mdk_rdev_t *rdev;
/* /*
* State bits: * State bits:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
typedef struct mirror_info mirror_info_t; typedef struct mirror_info mirror_info_t;
struct mirror_info { struct mirror_info {
struct block_device *bdev; mdk_rdev_t *rdev;
sector_t head_position; sector_t head_position;
atomic_t nr_pending; atomic_t nr_pending;
......
...@@ -192,11 +192,11 @@ struct stripe_head { ...@@ -192,11 +192,11 @@ struct stripe_head {
struct disk_info { struct disk_info {
struct block_device *bdev; mdk_rdev_t *rdev;
int operational; int operational;
int write_only; int write_only;
int spare; int spare;
int used_slot; int used_slot;
}; };
struct raid5_private_data { struct raid5_private_data {
......
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