Skip to content

Commit

Permalink
nullb: use blk_mq_alloc_disk
Browse files Browse the repository at this point in the history
Use blk_mq_alloc_disk and blk_cleanup_disk to simplify the gendisk and
request_queue allocation.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 11, 2021
1 parent 4af5f2e commit 6759b1a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/block/null_blk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6759b1a

Please sign in to comment.