summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-06-02 09:53:35 +0300
committerJens Axboe <axboe@kernel.dk>2021-06-11 11:54:39 -0600
commit6759b1a2013ba6f65e97f0b9444fa1cf69654f7c (patch)
treeeaf77dc085ac78f96d7ae49c442df35539cd7f28 /drivers/block
parent4af5f2e0301311f88c420fcfc5f3c8611ade20ac (diff)
nullb: use blk_mq_alloc_disk
Use blk_mq_alloc_disk and blk_cleanup_disk to simplify the gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Link: https://lore.kernel.org/r/20210602065345.355274-21-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/null_blk/main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 83d803cb57c8..3b320b005aa8 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1851,13 +1851,12 @@ static int null_add_dev(struct nullb_device *dev)
rv = -ENOMEM;
nullb->tag_set->timeout = 5 * HZ;
- nullb->q = blk_mq_init_queue_data(nullb->tag_set, nullb);
- if (IS_ERR(nullb->q))
+ nullb->disk = blk_mq_alloc_disk(nullb->tag_set, nullb);
+ if (IS_ERR(nullb->disk)) {
+ rv = PTR_ERR(nullb->disk);
goto out_cleanup_tags;
- nullb->disk = alloc_disk_node(1, nullb->dev->home_node);
- if (!nullb->disk)
- goto out_cleanup_tags;
- nullb->disk->queue = nullb->q;
+ }
+ nullb->q = nullb->disk->queue;
} else if (dev->queue_mode == NULL_Q_BIO) {
rv = -ENOMEM;
nullb->disk = blk_alloc_disk(nullb->dev->home_node);