From: Yu Kuai <yukuai3@xxxxxxxxxx> The bdi_dev_name() should not be used in blk-cgroup code, because bdi is not related at all, add a new helper to print device name directly from gendisk. The helper can also fix that "unknown" will be printed for hidden disks. Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> --- block/blk-cgroup.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index b9e3265c1eb3..d62bcc2bae14 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h @@ -239,6 +239,18 @@ static inline bool bio_issue_as_root_blkg(struct bio *bio) return (bio->bi_opf & (REQ_META | REQ_SWAP)) != 0; } +static inline bool blkg_print_dev_name(struct seq_file *sf, + struct blkcg_gq *blkg) +{ + struct gendisk *disk = blkg->q->disk; + + if (!disk) + return false; + + seq_printf(sf, "%u:%u", disk->major, disk->first_minor); + return true; +} + /** * blkg_lookup - lookup blkg for the specified blkcg - q pair * @blkcg: blkcg of interest -- 2.39.2