summaryrefslogtreecommitdiff
path: root/block/blk-settings.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-21 13:50:10 +0100
committerJens Axboe <axboe@kernel.dk>2024-02-21 07:21:28 -0700
commita3911966bd51b05488203e6e685c4a09fdc52b77 (patch)
treeebfa22a357a287d8cf087c680beb180cb560502d /block/blk-settings.c
parente440626b1caf3767eda2d78610dfdc0ae7fd5238 (diff)
block: fix virt_boundary handling in blk_validate_limits
Don't set the default max_segment_size value when a virt_boundary is used. Fixes: d690cb8ae14b ("block: add an API to atomically update queue limits") Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20240221125010.3609444-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-settings.c')
-rw-r--r--block/blk-settings.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index c4406aacc0ef..2120b6f9fef8 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -183,16 +183,6 @@ static int blk_validate_limits(struct queue_limits *lim)
return -EINVAL;
/*
- * The maximum segment size has an odd historic 64k default that
- * drivers probably should override. Just like the I/O size we
- * require drivers to at least handle a full page per segment.
- */
- if (!lim->max_segment_size)
- lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
- if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE))
- return -EINVAL;
-
- /*
* Devices that require a virtual boundary do not support scatter/gather
* I/O natively, but instead require a descriptor list entry for each
* page (which might not be identical to the Linux PAGE_SIZE). Because
@@ -203,6 +193,16 @@ static int blk_validate_limits(struct queue_limits *lim)
lim->max_segment_size != UINT_MAX))
return -EINVAL;
lim->max_segment_size = UINT_MAX;
+ } else {
+ /*
+ * The maximum segment size has an odd historic 64k default that
+ * drivers probably should override. Just like the I/O size we
+ * require drivers to at least handle a full page per segment.
+ */
+ if (!lim->max_segment_size)
+ lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
+ if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE))
+ return -EINVAL;
}
/*