summaryrefslogtreecommitdiff
path: root/drivers/block/null_blk
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-15 08:10:47 +0100
committerJens Axboe <axboe@kernel.dk>2024-02-19 16:58:23 -0700
commit74fa8f9c553f7b5ccab7d103acae63cc2e080465 (patch)
tree57800cbcef0bc3fe5dde4dd233bb1c006d0c4deb /drivers/block/null_blk
parent31edf4bbe0ba27fd03ac7d87eb2ee3d2a231af6d (diff)
block: pass a queue_limits argument to blk_alloc_disk
Pass a queue_limits to blk_alloc_disk and apply it if non-NULL. This will allow allocating queues with valid queue limits instead of setting the values one at a time later. Also change blk_alloc_disk to return an ERR_PTR instead of just NULL which can't distinguish errors. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Link: https://lore.kernel.org/r/20240215071055.2201424-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/null_blk')
-rw-r--r--drivers/block/null_blk/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index eeb895ec6f34..baf2b228d008 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -2154,10 +2154,11 @@ static int null_add_dev(struct nullb_device *dev)
}
nullb->q = nullb->disk->queue;
} else if (dev->queue_mode == NULL_Q_BIO) {
- rv = -ENOMEM;
- nullb->disk = blk_alloc_disk(nullb->dev->home_node);
- if (!nullb->disk)
+ nullb->disk = blk_alloc_disk(NULL, nullb->dev->home_node);
+ if (IS_ERR(nullb->disk)) {
+ rv = PTR_ERR(nullb->disk);
goto out_cleanup_queues;
+ }
nullb->q = nullb->disk->queue;
rv = init_driver_queues(nullb);