mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
block: add queue_to_disk() to get gendisk from request_queue
Sometimes we need to get the corresponding gendisk from request_queue.
It is preferred that block drivers store private data in
gendisk->private_data rather than request_queue->queuedata, e.g. see:
commit c4a59c4e5d
("dm: stop using ->queuedata").
So if only request_queue is given, we need to get its corresponding
gendisk to get the private data stored in that gendisk.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
cbb749cf37
commit
907d523100
@ -689,6 +689,8 @@ static inline bool blk_account_rq(struct request *rq)
|
||||
dma_map_page_attrs(dev, (bv)->bv_page, (bv)->bv_offset, (bv)->bv_len, \
|
||||
(dir), (attrs))
|
||||
|
||||
#define queue_to_disk(q) (dev_to_disk(kobj_to_dev((q)->kobj.parent)))
|
||||
|
||||
static inline bool queue_is_mq(struct request_queue *q)
|
||||
{
|
||||
return q->mq_ops;
|
||||
|
@ -30,7 +30,7 @@ TRACE_EVENT(kyber_latency,
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->dev = disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
|
||||
__entry->dev = disk_devt(queue_to_disk(q));
|
||||
strlcpy(__entry->domain, domain, sizeof(__entry->domain));
|
||||
strlcpy(__entry->type, type, sizeof(__entry->type));
|
||||
__entry->percentile = percentile;
|
||||
@ -59,7 +59,7 @@ TRACE_EVENT(kyber_adjust,
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->dev = disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
|
||||
__entry->dev = disk_devt(queue_to_disk(q));
|
||||
strlcpy(__entry->domain, domain, sizeof(__entry->domain));
|
||||
__entry->depth = depth;
|
||||
),
|
||||
@ -81,7 +81,7 @@ TRACE_EVENT(kyber_throttled,
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->dev = disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
|
||||
__entry->dev = disk_devt(queue_to_disk(q));
|
||||
strlcpy(__entry->domain, domain, sizeof(__entry->domain));
|
||||
),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user