mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
blk-mq: add the blk_mq_alloc_disk APIs
Add a new API to allocate a gendisk including the request_queue for use with blk-mq based drivers. This is to avoid boilerplate code in drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Link: https://lore.kernel.org/r/20210602065345.355274-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
26a9750aa8
commit
b461dfc49e
2 changed files with 31 additions and 0 deletions
|
@ -426,6 +426,18 @@ enum {
|
|||
((policy & ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) \
|
||||
<< BLK_MQ_F_ALLOC_POLICY_START_BIT)
|
||||
|
||||
#define blk_mq_alloc_disk(set, queuedata) \
|
||||
({ \
|
||||
static struct lock_class_key __key; \
|
||||
struct gendisk *__disk = __blk_mq_alloc_disk(set, queuedata); \
|
||||
\
|
||||
if (__disk) \
|
||||
lockdep_init_map(&__disk->lockdep_map, \
|
||||
"(bio completion)", &__key, 0); \
|
||||
__disk; \
|
||||
})
|
||||
struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set,
|
||||
void *queuedata);
|
||||
struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
|
||||
struct request_queue *blk_mq_init_queue_data(struct blk_mq_tag_set *set,
|
||||
void *queuedata);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue