aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiufei Xue <jiufei.xue@linux.alibaba.com>2018-02-27 07:10:18 -0500
committerJens Axboe <axboe@kernel.dk>2018-03-01 10:41:25 -0500
commit9c0fb1e313aaf4e8edec22433c8b22dd308e466c (patch)
tree8547474277534911851c0370b417b86ba1b39aac
parent7c5a0dcf557c6511a61e092ba887de28882fe857 (diff)
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: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index") Reviewed-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/partition-generic.c6
-rw-r--r--include/linux/bio.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 91622db9aedf..08dabcd8b6ae 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -51,6 +51,12 @@ const char *bdevname(struct block_device *bdev, char *buf)
51 51
52EXPORT_SYMBOL(bdevname); 52EXPORT_SYMBOL(bdevname);
53 53
54const char *bio_devname(struct bio *bio, char *buf)
55{
56 return disk_name(bio->bi_disk, bio->bi_partno, buf);
57}
58EXPORT_SYMBOL(bio_devname);
59
54/* 60/*
55 * There's very little reason to use this, you should really 61 * There's very little reason to use this, you should really
56 * have a struct block_device just about everywhere and use 62 * have a struct block_device just about everywhere and use
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d0eb659fa733..ce547a25e8ae 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -511,6 +511,7 @@ void zero_fill_bio(struct bio *bio);
511extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *); 511extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);
512extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int); 512extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);
513extern unsigned int bvec_nr_vecs(unsigned short idx); 513extern unsigned int bvec_nr_vecs(unsigned short idx);
514extern const char *bio_devname(struct bio *bio, char *buffer);
514 515
515#define bio_set_dev(bio, bdev) \ 516#define bio_set_dev(bio, bdev) \
516do { \ 517do { \
@@ -529,9 +530,6 @@ do { \
529#define bio_dev(bio) \ 530#define bio_dev(bio) \
530 disk_devt((bio)->bi_disk) 531 disk_devt((bio)->bi_disk)
531 532
532#define bio_devname(bio, buf) \
533 __bdevname(bio_dev(bio), (buf))
534
535#ifdef CONFIG_BLK_CGROUP 533#ifdef CONFIG_BLK_CGROUP
536int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); 534int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css);
537void bio_disassociate_task(struct bio *bio); 535void bio_disassociate_task(struct bio *bio);