Commit 45b3e77f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: Replace bdev_partition_name with calls to bdevname

parent 89670a77
......@@ -254,12 +254,13 @@ static void linear_status (struct seq_file *seq, mddev_t *mddev)
seq_printf(seq, " ");
for (j = 0; j < conf->nr_zones; j++)
{
char b[BDEVNAME_SIZE];
seq_printf(seq, "[%s",
bdev_partition_name(conf->hash_table[j].dev0->rdev->bdev));
bdevname(conf->hash_table[j].dev0->rdev->bdev,b));
if (conf->hash_table[j].dev1)
seq_printf(seq, "/%s] ",
bdev_partition_name(conf->hash_table[j].dev1->rdev->bdev));
bdevname(conf->hash_table[j].dev1->rdev->bdev,b));
else
seq_printf(seq, "] ");
}
......
This diff is collapsed.
......@@ -127,9 +127,10 @@ int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error)
/*
* oops, IO error:
*/
char b[BDEVNAME_SIZE];
md_error (mp_bh->mddev, rdev);
printk(KERN_ERR "multipath: %s: rescheduling sector %llu\n",
bdev_partition_name(rdev->bdev),
bdevname(rdev->bdev,b),
(unsigned long long)bio->bi_sector);
multipath_reschedule_retry(mp_bh);
}
......@@ -220,6 +221,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
* Mark disk as unusable
*/
if (!rdev->faulty) {
char b[BDEVNAME_SIZE];
rdev->in_sync = 0;
rdev->faulty = 1;
mddev->sb_dirty = 1;
......@@ -227,7 +229,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
printk(KERN_ALERT "multipath: IO failure on %s,"
" disabling IO path. \n Operation continuing"
" on %d IO paths.\n",
bdev_partition_name (rdev->bdev),
bdevname (rdev->bdev,b),
conf->working_disks);
}
}
......@@ -247,11 +249,12 @@ static void print_multipath_conf (multipath_conf_t *conf)
conf->raid_disks);
for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
tmp = conf->multipaths + i;
if (tmp->rdev)
printk(" disk%d, o:%d, dev:%s\n",
i,!tmp->rdev->faulty,
bdev_partition_name(tmp->rdev->bdev));
bdevname(tmp->rdev->bdev,b));
}
}
......@@ -326,6 +329,7 @@ static void multipathd (mddev_t *mddev)
md_check_recovery(mddev);
for (;;) {
char b[BDEVNAME_SIZE];
spin_lock_irqsave(&retry_list_lock, flags);
mp_bh = multipath_retry_list;
if (!mp_bh)
......@@ -341,13 +345,13 @@ static void multipathd (mddev_t *mddev)
if (multipath_map (mddev, &rdev)<0) {
printk(KERN_ALERT "multipath: %s: unrecoverable IO read"
" error for block %llu\n",
bdev_partition_name(bio->bi_bdev),
bdevname(bio->bi_bdev,b),
(unsigned long long)bio->bi_sector);
multipath_end_bh_io(mp_bh, 0);
} else {
printk(KERN_ERR "multipath: %s: redirecting sector %llu"
" to another IO path\n",
bdev_partition_name(bio->bi_bdev),
bdevname(bio->bi_bdev,b),
(unsigned long long)bio->bi_sector);
bio->bi_bdev = rdev->bdev;
generic_make_request(bio);
......
......@@ -36,6 +36,7 @@ static int create_strip_zones (mddev_t *mddev)
struct list_head *tmp1, *tmp2;
struct strip_zone *zone;
int cnt;
char b[BDEVNAME_SIZE];
/*
* The number of 'same size groups'
......@@ -44,14 +45,15 @@ static int create_strip_zones (mddev_t *mddev)
ITERATE_RDEV(mddev,rdev1,tmp1) {
printk("raid0: looking at %s\n",
bdev_partition_name(rdev1->bdev));
bdevname(rdev1->bdev,b));
c = 0;
ITERATE_RDEV(mddev,rdev2,tmp2) {
printk("raid0: comparing %s(%llu) with %s(%llu)\n",
bdev_partition_name(rdev1->bdev),
(unsigned long long)rdev1->size,
bdev_partition_name(rdev2->bdev),
(unsigned long long)rdev2->size);
printk("raid0: comparing %s(%llu)",
bdevname(rdev1->bdev,b),
(unsigned long long)rdev1->size);
printk(" with %s(%llu)\n",
bdevname(rdev2->bdev,b),
(unsigned long long)rdev2->size);
if (rdev2 == rdev1) {
printk("raid0: END\n");
break;
......@@ -138,8 +140,9 @@ static int create_strip_zones (mddev_t *mddev)
c = 0;
for (j=0; j<cnt; j++) {
char b[BDEVNAME_SIZE];
rdev = conf->strip_zone[0].dev[j];
printk("raid0: checking %s ...", bdev_partition_name(rdev->bdev));
printk("raid0: checking %s ...", bdevname(rdev->bdev,b));
if (rdev->size > current_offset)
{
printk(" contained as device %d\n", c);
......@@ -404,6 +407,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
#undef MD_DEBUG
#ifdef MD_DEBUG
int j, k, h;
char b[BDEVNAME_SIZE];
raid0_conf_t *conf = mddev_to_conf(mddev);
h = 0;
......@@ -413,8 +417,8 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
seq_printf("(h%d)", h++);
seq_printf(seq, "=[");
for (k = 0; k < conf->strip_zone[j].nb_dev; k++)
seq_printf (seq, "%s/", bdev_partition_name(
conf->strip_zone[j].dev[k]->bdev));
seq_printf (seq, "%s/", bdevname(
conf->strip_zone[j].dev[k]->bdev,b));
seq_printf (seq, "] zo=%d do=%d s=%d\n",
conf->strip_zone[j].zone_offset,
......
......@@ -308,8 +308,9 @@ static int raid1_end_request(struct bio *bio, unsigned int bytes_done, int error
/*
* oops, read error:
*/
char b[BDEVNAME_SIZE];
printk(KERN_ERR "raid1: %s: rescheduling sector %llu\n",
bdev_partition_name(conf->mirrors[mirror].rdev->bdev), (unsigned long long)r1_bio->sector);
bdevname(conf->mirrors[mirror].rdev->bdev,b), (unsigned long long)r1_bio->sector);
reschedule_retry(r1_bio);
}
} else {
......@@ -597,6 +598,7 @@ static void status(struct seq_file *seq, mddev_t *mddev)
static void error(mddev_t *mddev, mdk_rdev_t *rdev)
{
char b[BDEVNAME_SIZE];
conf_t *conf = mddev_to_conf(mddev);
/*
......@@ -625,7 +627,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
mddev->sb_dirty = 1;
printk(KERN_ALERT "raid1: Disk failure on %s, disabling device. \n"
" Operation continuing on %d devices\n",
bdev_partition_name(rdev->bdev), conf->working_disks);
bdevname(rdev->bdev,b), conf->working_disks);
}
static void print_conf(conf_t *conf)
......@@ -642,11 +644,12 @@ static void print_conf(conf_t *conf)
conf->raid_disks);
for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
tmp = conf->mirrors + i;
if (tmp->rdev)
printk(" disk %d, wo:%d, o:%d, dev:%s\n",
i, !tmp->rdev->in_sync, !tmp->rdev->faulty,
bdev_partition_name(tmp->rdev->bdev));
bdevname(tmp->rdev->bdev,b));
}
}
......@@ -814,9 +817,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
* There is no point trying a read-for-reconstruct as
* reconstruct is about to be aborted
*/
char b[BDEVNAME_SIZE];
printk(KERN_ALERT "raid1: %s: unrecoverable I/O read error"
" for block %llu\n",
bdev_partition_name(bio->bi_bdev),
bdevname(bio->bi_bdev,b),
(unsigned long long)r1_bio->sector);
md_done_sync(mddev, r1_bio->master_bio->bi_size >> 9, 0);
put_buf(r1_bio);
......@@ -906,6 +910,7 @@ static void raid1d(mddev_t *mddev)
md_handle_safemode(mddev);
for (;;) {
char b[BDEVNAME_SIZE];
spin_lock_irqsave(&retry_list_lock, flags);
if (list_empty(head))
break;
......@@ -925,14 +930,14 @@ static void raid1d(mddev_t *mddev)
if (map(mddev, &rdev) == -1) {
printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
" read error for block %llu\n",
bdev_partition_name(bio->bi_bdev),
bdevname(bio->bi_bdev,b),
(unsigned long long)r1_bio->sector);
raid_end_bio_io(r1_bio);
break;
}
printk(KERN_ERR "raid1: %s: redirecting sector %llu to"
" another mirror\n",
bdev_partition_name(rdev->bdev),
bdevname(rdev->bdev,b),
(unsigned long long)r1_bio->sector);
bio->bi_bdev = rdev->bdev;
bio->bi_sector = r1_bio->sector + rdev->data_offset;
......
......@@ -457,6 +457,7 @@ static void raid5_build_block (struct stripe_head *sh, int i)
static void error(mddev_t *mddev, mdk_rdev_t *rdev)
{
char b[BDEVNAME_SIZE];
raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
PRINTK("raid5: error called\n");
......@@ -476,7 +477,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
printk (KERN_ALERT
"raid5: Disk failure on %s, disabling device."
" Operation continuing on %d devices\n",
bdev_partition_name(rdev->bdev), conf->working_disks);
bdevname(rdev->bdev,b), conf->working_disks);
}
}
......@@ -1486,8 +1487,9 @@ static int run (mddev_t *mddev)
disk->rdev = rdev;
if (rdev->in_sync) {
char b[BDEVNAME_SIZE];
printk(KERN_INFO "raid5: device %s operational as raid"
" disk %d\n", bdev_partition_name(rdev->bdev),
" disk %d\n", bdevname(rdev->bdev,b),
raid_disk);
conf->working_disks++;
}
......@@ -1663,11 +1665,12 @@ static void print_raid5_conf (raid5_conf_t *conf)
conf->working_disks, conf->failed_disks);
for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
tmp = conf->disks + i;
if (tmp->rdev)
printk(" disk %d, o:%d, dev:%s\n",
i, !tmp->rdev->faulty,
bdev_partition_name(tmp->rdev->bdev));
bdevname(tmp->rdev->bdev,b));
}
}
......
......@@ -62,21 +62,6 @@
#define MD_MINOR_VERSION 90
#define MD_PATCHLEVEL_VERSION 0
/*
* XXX(hch): This function is broken. Someone who understands the md
* code needs to go through all callers, check whether bdev could
* be NULL and replace it with direct calls to bdevmame.
*
* This would also fix the returns buffer on stack issue nicely :)
*/
static inline const char *bdev_partition_name (struct block_device *bdev)
{
char b[BDEVNAME_SIZE];
if (!bdev)
return __bdevname(0, b);
return bdevname(bdev, b);
}
extern int register_md_personality (int p_num, mdk_personality_t *p);
extern int unregister_md_personality (int p_num);
extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
......
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