summaryrefslogtreecommitdiff
path: root/block/genhd.c
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 /block/genhd.c
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 'block/genhd.c')
-rw-r--r--block/genhd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 7a8fd57c51f7..84c822d989da 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1391,20 +1391,21 @@ out_free_disk:
return NULL;
}
-struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass)
+struct gendisk *__blk_alloc_disk(struct queue_limits *lim, int node,
+ struct lock_class_key *lkclass)
{
- struct queue_limits lim = { };
+ struct queue_limits default_lim = { };
struct request_queue *q;
struct gendisk *disk;
- q = blk_alloc_queue(&lim, node);
+ q = blk_alloc_queue(lim ? lim : &default_lim, node);
if (IS_ERR(q))
- return NULL;
+ return ERR_CAST(q);
disk = __alloc_disk_node(q, node, lkclass);
if (!disk) {
blk_put_queue(q);
- return NULL;
+ return ERR_PTR(-ENOMEM);
}
set_bit(GD_OWNS_QUEUE, &disk->state);
return disk;