Skip to content

Commit 470d2bc

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: export blk_validate_limits
While block drivers do the validation as part of committing them to the queue, users that use the limit outside of a block device context have to validate the limits and fill in the calculated values as well. So far btrfs is the only user of queue limits without a block device, and it has gotten away with that more or less by accident. But with commit 559218d ("block: pre-calculate max_zone_append_sectors") this became fatal for setups that have small max zone append size, as it won't be limited now. Export blk_validate_limits so that it can be called directly from btrfs. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 15da3dd commit 470d2bc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

block/blk-settings.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void blk_validate_atomic_write_limits(struct queue_limits *lim)
222222
* Check that the limits in lim are valid, initialize defaults for unset
223223
* values, and cap values based on others where needed.
224224
*/
225-
static int blk_validate_limits(struct queue_limits *lim)
225+
int blk_validate_limits(struct queue_limits *lim)
226226
{
227227
unsigned int max_hw_sectors;
228228
unsigned int logical_block_sectors;
@@ -365,6 +365,7 @@ static int blk_validate_limits(struct queue_limits *lim)
365365
return err;
366366
return blk_validate_zoned_limits(lim);
367367
}
368+
EXPORT_SYMBOL_GPL(blk_validate_limits);
368369

369370
/*
370371
* Set the default limits for a newly allocated queue. @lim contains the

include/linux/blkdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ queue_limits_start_update(struct request_queue *q)
948948
int queue_limits_commit_update(struct request_queue *q,
949949
struct queue_limits *lim);
950950
int queue_limits_set(struct request_queue *q, struct queue_limits *lim);
951+
int blk_validate_limits(struct queue_limits *lim);
951952

952953
/**
953954
* queue_limits_cancel_update - cancel an atomic update of queue limits

0 commit comments

Comments
 (0)