summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-28 14:56:40 -0800
committerJens Axboe <axboe@kernel.dk>2024-03-01 08:54:42 -0700
commit631d4efb8009df64deae8c1382b8cf43879a4e22 (patch)
tree5a1cb6d6c1223c895fd9baa6a5db958994195f41 /block
parent86b1e613eb3b8e6a0f87676e33d847b2eb204b22 (diff)
block: add a queue_limits_set helper
Add a small wrapper around queue_limits_commit_update for stacking drivers that don't want to update existing limits, but set an entirely new set. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20240228225653.947152-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-settings.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index b6bbe683d218..1989a177be20 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -267,6 +267,24 @@ int queue_limits_commit_update(struct request_queue *q,
EXPORT_SYMBOL_GPL(queue_limits_commit_update);
/**
+ * queue_limits_commit_set - apply queue limits to queue
+ * @q: queue to update
+ * @lim: limits to apply
+ *
+ * Apply the limits in @lim that were freshly initialized to @q.
+ * To update existing limits use queue_limits_start_update() and
+ * queue_limits_commit_update() instead.
+ *
+ * Returns 0 if successful, else a negative error code.
+ */
+int queue_limits_set(struct request_queue *q, struct queue_limits *lim)
+{
+ mutex_lock(&q->limits_lock);
+ return queue_limits_commit_update(q, lim);
+}
+EXPORT_SYMBOL_GPL(queue_limits_set);
+
+/**
* blk_queue_bounce_limit - set bounce buffer limit for queue
* @q: the request queue for the device
* @bounce: bounce limit to enforce