Commit 9c0fb1e3 authored by Jiufei Xue's avatar Jiufei Xue Committed by Jens Axboe

block: display the correct diskname for bio

bio_devname use __bdevname to display the device name, and can
only show the major and minor of the part0,
Fix this by using disk_name to display the correct name.

Fixes: 74d46992 ("block: replace bi_bdev with a gendisk pointer and partitions index")
Reviewed-by: default avatarOmar Sandoval <osandov@fb.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJiufei Xue <jiufei.xue@linux.alibaba.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7c5a0dcf
...@@ -51,6 +51,12 @@ const char *bdevname(struct block_device *bdev, char *buf) ...@@ -51,6 +51,12 @@ const char *bdevname(struct block_device *bdev, char *buf)
EXPORT_SYMBOL(bdevname); EXPORT_SYMBOL(bdevname);
const char *bio_devname(struct bio *bio, char *buf)
{
return disk_name(bio->bi_disk, bio->bi_partno, buf);
}
EXPORT_SYMBOL(bio_devname);
/* /*
* There's very little reason to use this, you should really * There's very little reason to use this, you should really
* have a struct block_device just about everywhere and use * have a struct block_device just about everywhere and use
......
...@@ -511,6 +511,7 @@ void zero_fill_bio(struct bio *bio); ...@@ -511,6 +511,7 @@ void zero_fill_bio(struct bio *bio);
extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *); extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);
extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int); extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);
extern unsigned int bvec_nr_vecs(unsigned short idx); extern unsigned int bvec_nr_vecs(unsigned short idx);
extern const char *bio_devname(struct bio *bio, char *buffer);
#define bio_set_dev(bio, bdev) \ #define bio_set_dev(bio, bdev) \
do { \ do { \
...@@ -529,9 +530,6 @@ do { \ ...@@ -529,9 +530,6 @@ do { \
#define bio_dev(bio) \ #define bio_dev(bio) \
disk_devt((bio)->bi_disk) disk_devt((bio)->bi_disk)
#define bio_devname(bio, buf) \
__bdevname(bio_dev(bio), (buf))
#ifdef CONFIG_BLK_CGROUP #ifdef CONFIG_BLK_CGROUP
int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css);
void bio_disassociate_task(struct bio *bio); void bio_disassociate_task(struct bio *bio);
......
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