Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

Commit 9c0fb1e

Browse files
Jiufei Xueaxboe
authored andcommitted
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: 74d4699 ("block: replace bi_bdev with a gendisk pointer and partitions index") Reviewed-by: Omar Sandoval <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jiufei Xue <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 7c5a0dc commit 9c0fb1e

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

block/partition-generic.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ const char *bdevname(struct block_device *bdev, char *buf)
5151

5252
EXPORT_SYMBOL(bdevname);
5353

54+
const char *bio_devname(struct bio *bio, char *buf)
55+
{
56+
return disk_name(bio->bi_disk, bio->bi_partno, buf);
57+
}
58+
EXPORT_SYMBOL(bio_devname);
59+
5460
/*
5561
* There's very little reason to use this, you should really
5662
* have a struct block_device just about everywhere and use

include/linux/bio.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ void zero_fill_bio(struct bio *bio);
511511
extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);
512512
extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);
513513
extern unsigned int bvec_nr_vecs(unsigned short idx);
514+
extern const char *bio_devname(struct bio *bio, char *buffer);
514515

515516
#define bio_set_dev(bio, bdev) \
516517
do { \
@@ -529,9 +530,6 @@ do { \
529530
#define bio_dev(bio) \
530531
disk_devt((bio)->bi_disk)
531532

532-
#define bio_devname(bio, buf) \
533-
__bdevname(bio_dev(bio), (buf))
534-
535533
#ifdef CONFIG_BLK_CGROUP
536534
int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css);
537535
void bio_disassociate_task(struct bio *bio);

0 commit comments

Comments
 (0)