validate queue limits in btrfs
Subsystems (2)
Hi Jens, hi btrfs maintainers,
a recent patch from me exposed the fact that btrfs did call the helper to validate the queue limits, which is also used to fill in precalculated values. This series fixes that and is needed to fix a blktests regression
in the current block tree. I'd thus recommend to merge it through the
block tree ASAP.
PATCH 1/2 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 559218d43ec9 ("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.
--- block/blk-settings.c | 3 ++- include/linux/blkdev.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
block/blk-settings.c +2 -1
@@ -222,7 +222,7 @@ static void blk_validate_atomic_write_limits(struct queue_limits *lim)* Check that the limits in lim are valid, initialize defaults for unset * values, and cap values based on others where needed. */ -static int blk_validate_limits (struct queue_limits *lim) +int blk_validate_limits (struct queue_limits *lim) {unsigned int max_hw_sectors;unsigned int logical_block_sectors;
@@ -365,6 +365,7 @@ static int blk_validate_limits(struct queue_limits *lim)return err;return blk_validate_zoned_limits (lim); } +EXPORT_SYMBOL_GPL (blk_validate_limits);/* * Set the default limits for a newly allocated queue. @lim contains the
include/linux/blkdev.h +1 -0
@@ -948,6 +948,7 @@ queue_limits_start_update(struct request_queue *q)int queue_limits_commit_update (struct request_queue *q,struct queue_limits *lim);int queue_limits_set (struct request_queue *q,struct queue_limits *lim); +int blk_validate_limits (struct queue_limits *lim);/** * queue_limits_cancel_update - cancel an atomic update of queue limits
Signature · 1 line
2.45.2
Re: [PATCH 1/2] block: export blk_validate_limits
Looks good,
Re: [PATCH 1/2] block: export blk_validate_limits
In reply to Christoph HellwigQuoted 11 lines · Christoph Hellwig
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
559218d43ec9("block: pre-calculatemax_zone_append_sectors") this became fatal for setups that have small max zone append size, as it won't be limited now.[...]
Applied, thanks!
[1/2] block: export blk_validate_limits
commit: 470d2bc3a0bc19a849cc7478c02d3f5ecaa1233e
[2/2] btrfs: validate queue limits
commit: e559ee022658c70bdc07c4846bf279f5a5abc494Best regards,
Signature · 1 line
Jens Axboe
PATCH 2/2 btrfs: validate queue limits
In reply to Christoph HellwigCall blk_validate_limits on the queue limits used for zone append splitting so that calculated values get filled in and any stacking conflicts get cought.
Without this there isn't a max_zone_append_sectors limits as of commit 559218d43ec9 ("block: pre-calculate max_zone_append_sectors").
--- fs/btrfs/zoned.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/zoned.c +6 -0
@@ -711,6 +711,12 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)blk_stack_limits (lim,bdev_limits (device->bdev),0 ); } + ret =blk_validate_limits (lim); +if (ret) { +btrfs_err (fs_info,"zoned: failed to validate queue limits" ); +return ret; + } +/* * stripe_size is always aligned to BTRFS_STRIPE_LEN in * btrfs_create_chunk(). Since we want stripe_len == zone_size,
Signature · 1 line
2.45.2
Re: [PATCH 2/2] btrfs: validate queue limits
Looks good,
Quoted 7 lines · Christoph Hellwig
Hi Jens, hi btrfs maintainers,
a recent patch from me exposed the fact that btrfs did call the helper to validate the queue limits, which is also used to fill in precalculated values. This series fixes that and is needed to fix a blktests regression
in the current block tree. I'd thus recommend to merge it through the
block tree ASAP.
Ok, ack for the btrfs patch, thanks.