diff mbox series

[2/3] block: don't reduce max_sectors based on io_opt

Message ID 20240701051800.1245240-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/3] block: remove a duplicate io_min check in blk_validate_limits | expand

Commit Message

Christoph Hellwig July 1, 2024, 5:17 a.m. UTC
Don't reduce the max_sectors value below the normal cap when the driver
advertsizes a very low io_opt.  This restores the behavior we had before
the recent changes to the max_sectors calculation.

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

Comments

Chaitanya Kulkarni July 1, 2024, 6:42 a.m. UTC | #1
On 6/30/24 22:17, Christoph Hellwig wrote:
> Don't reduce the max_sectors value below the normal cap when the driver
> advertsizes a very low io_opt.  This restores the behavior we had before
> the recent changes to the max_sectors calculation.
>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
Sagi Grimberg July 1, 2024, 7:08 a.m. UTC | #2
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
diff mbox series

Patch

diff --git a/block/blk-settings.c b/block/blk-settings.c
index ff8bbc101fedaa..9fa4eed4df06b0 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -276,7 +276,7 @@  static int blk_validate_limits(struct queue_limits *lim)
 		if (lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
 			return -EINVAL;
 		lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors);
-	} else if (lim->io_opt) {
+	} else if (lim->io_opt > (BLK_DEF_MAX_SECTORS_CAP << SECTOR_SHIFT)) {
 		lim->max_sectors =
 			min(max_hw_sectors, lim->io_opt >> SECTOR_SHIFT);
 	} else if (lim->io_min > (BLK_DEF_MAX_SECTORS_CAP << SECTOR_SHIFT)) {