Skip to content

Commit ffd379c

Browse files
Ming Leiaxboe
authored andcommitted
block: set default max segment size in case of virt_boundary
For devices with virt_boundary limit, the driver may provide zero max segment size, we have to set it as UINT_MAX at default. Otherwise, it may cause warning in driver when handling sglist. Fix it by setting default max segment size as UINT_MAX. Cc: Christoph Hellwig <hch@lst.de> Cc: Mike Snitzer <snitzer@kernel.org> Fixes: b561ea5 ("block: allow device to have both virt_boundary_mask and max segment size") Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Closes: https://lore.kernel.org/linux-block/7e38b67c-9372-a42d-41eb-abdce33d3372@linux-m68k.org/ Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20240424134722.2584284-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent fb15ffd commit ffd379c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

block/blk-settings.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ static int blk_validate_limits(struct queue_limits *lim)
188188
* bvec and lower layer bio splitting is supposed to handle the two
189189
* correctly.
190190
*/
191-
if (!lim->virt_boundary_mask) {
191+
if (lim->virt_boundary_mask) {
192+
if (!lim->max_segment_size)
193+
lim->max_segment_size = UINT_MAX;
194+
} else {
192195
/*
193196
* The maximum segment size has an odd historic 64k default that
194197
* drivers probably should override. Just like the I/O size we

0 commit comments

Comments
 (0)