Skip to content

Commit 631d4ef

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 86b1e61 commit 631d4ef

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

block/blk-settings.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,24 @@ int queue_limits_commit_update(struct request_queue *q,
266266
}
267267
EXPORT_SYMBOL_GPL(queue_limits_commit_update);
268268

269+
/**
270+
* queue_limits_commit_set - apply queue limits to queue
271+
* @q: queue to update
272+
* @lim: limits to apply
273+
*
274+
* Apply the limits in @lim that were freshly initialized to @q.
275+
* To update existing limits use queue_limits_start_update() and
276+
* queue_limits_commit_update() instead.
277+
*
278+
* Returns 0 if successful, else a negative error code.
279+
*/
280+
int queue_limits_set(struct request_queue *q, struct queue_limits *lim)
281+
{
282+
mutex_lock(&q->limits_lock);
283+
return queue_limits_commit_update(q, lim);
284+
}
285+
EXPORT_SYMBOL_GPL(queue_limits_set);
286+
269287
/**
270288
* blk_queue_bounce_limit - set bounce buffer limit for queue
271289
* @q: the request queue for the device

include/linux/blkdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ queue_limits_start_update(struct request_queue *q)
889889
}
890890
int queue_limits_commit_update(struct request_queue *q,
891891
struct queue_limits *lim);
892+
int queue_limits_set(struct request_queue *q, struct queue_limits *lim);
892893

893894
/*
894895
* Access functions for manipulating queue properties

0 commit comments

Comments
 (0)