diff mbox series

[2/5] block: fix max_zone_append_sectors inheritance in blk_stack_limits

Message ID 20220720142456.1414262-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/5] block: move ->bio_split to the gendisk | expand

Commit Message

Christoph Hellwig July 20, 2022, 2:24 p.m. UTC
As we start out with a default of 0, this needs a min_not_zero to
actually work.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Damien Le Moal July 22, 2022, 5:59 a.m. UTC | #1
On 7/20/22 23:24, Christoph Hellwig wrote:
> As we start out with a default of 0, this needs a min_not_zero to
> actually work.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-settings.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 8bb9eef5310eb..9f6e271ca67f4 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -554,7 +554,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
>  	t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors);
>  	t->max_write_zeroes_sectors = min(t->max_write_zeroes_sectors,
>  					b->max_write_zeroes_sectors);
> -	t->max_zone_append_sectors = min(t->max_zone_append_sectors,
> +	t->max_zone_append_sectors = min_not_zero(t->max_zone_append_sectors,
>  					b->max_zone_append_sectors);

Hmmm... Given that max_zone_append_sectors should never be zero for any
zoned block device, that is OK. However, DM targets combining zoned and
non-zoned devices to create a non zoned logical drive, e.g. dm-zoned with
a regular ssd for metadata, should not have a non-zero
max_zone_append_sectors. So I am not confident this change leads to
correct limits in all cases.

>  	t->bounce = max(t->bounce, b->bounce);
>
Christoph Hellwig July 22, 2022, 6:03 a.m. UTC | #2
On Fri, Jul 22, 2022 at 02:59:30PM +0900, Damien Le Moal wrote:
> Hmmm... Given that max_zone_append_sectors should never be zero for any
> zoned block device, that is OK. However, DM targets combining zoned and
> non-zoned devices to create a non zoned logical drive, e.g. dm-zoned with
> a regular ssd for metadata, should not have a non-zero
> max_zone_append_sectors. So I am not confident this change leads to
> correct limits in all cases.

Good point.

I think we can drop this patch, as I just need to call
blk_set_stacking_limits instead of blk_set_default_limits in the
btrfs code, which should sort all this out.
diff mbox series

Patch

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 8bb9eef5310eb..9f6e271ca67f4 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -554,7 +554,7 @@  int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 	t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors);
 	t->max_write_zeroes_sectors = min(t->max_write_zeroes_sectors,
 					b->max_write_zeroes_sectors);
-	t->max_zone_append_sectors = min(t->max_zone_append_sectors,
+	t->max_zone_append_sectors = min_not_zero(t->max_zone_append_sectors,
 					b->max_zone_append_sectors);
 	t->bounce = max(t->bounce, b->bounce);