]> www.infradead.org Git - users/hch/block.git/commitdiff
blk-iocost: simplify ioc_name
authorChristoph Hellwig <hch@lst.de>
Sat, 21 May 2022 08:12:15 +0000 (10:12 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 18 Jun 2022 14:28:41 +0000 (16:28 +0200)
Just directly dereference the disk name instead of going through multiple
hoops to find the same value.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/blk-iocost.c

index 33a11ba971eafeb0ac9e022ffb5032ee06f133be..35d6b4c0b88a050c9bb409abda6dc97a325931cd 100644 (file)
@@ -664,17 +664,13 @@ static struct ioc *q_to_ioc(struct request_queue *q)
        return rqos_to_ioc(rq_qos_id(q, RQ_QOS_COST));
 }
 
-static const char *q_name(struct request_queue *q)
-{
-       if (blk_queue_registered(q))
-               return kobject_name(q->kobj.parent);
-       else
-               return "<unknown>";
-}
-
 static const char __maybe_unused *ioc_name(struct ioc *ioc)
 {
-       return q_name(ioc->rqos.q);
+       struct gendisk *disk = ioc->rqos.q->disk;
+
+       if (!disk)
+               return "<unknown>";
+       return disk->disk_name;
 }
 
 static struct ioc_gq *pd_to_iocg(struct blkg_policy_data *pd)