Skip to content

Commit b561ea5

Browse files
Ming Leiaxboe
authored andcommitted
block: allow device to have both virt_boundary_mask and max segment size
When one stacking device is over one device with virt_boundary_mask and another one with max segment size, the stacking device have both limits set. This way is allowed before d690cb8 ("block: add an API to atomically update queue limits"). Relax the limit so that we won't break such kind of stacking setting. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218687 Reported-by: janpieter.sollie@edpnet.be Fixes: d690cb8 ("block: add an API to atomically update queue limits") Link: https://lore.kernel.org/linux-block/ZfGl8HzUpiOxCLm3@fedora/ Cc: Christoph Hellwig <hch@lst.de> Cc: Mike Snitzer <snitzer@kernel.org> Cc: dm-devel@lists.linux.dev Cc: Song Liu <song@kernel.org> Cc: linux-raid@vger.kernel.org Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Mike Snitzer <snitzer@kernel.org> Link: https://lore.kernel.org/r/20240407131931.4055231-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8b8ace0 commit b561ea5

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

block/blk-settings.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,13 @@ static int blk_validate_limits(struct queue_limits *lim)
182182
return -EINVAL;
183183

184184
/*
185-
* Devices that require a virtual boundary do not support scatter/gather
186-
* I/O natively, but instead require a descriptor list entry for each
187-
* page (which might not be identical to the Linux PAGE_SIZE). Because
188-
* of that they are not limited by our notion of "segment size".
185+
* Stacking device may have both virtual boundary and max segment
186+
* size limit, so allow this setting now, and long-term the two
187+
* might need to move out of stacking limits since we have immutable
188+
* bvec and lower layer bio splitting is supposed to handle the two
189+
* correctly.
189190
*/
190-
if (lim->virt_boundary_mask) {
191-
if (WARN_ON_ONCE(lim->max_segment_size &&
192-
lim->max_segment_size != UINT_MAX))
193-
return -EINVAL;
194-
lim->max_segment_size = UINT_MAX;
195-
} else {
191+
if (!lim->virt_boundary_mask) {
196192
/*
197193
* The maximum segment size has an odd historic 64k default that
198194
* drivers probably should override. Just like the I/O size we

0 commit comments

Comments
 (0)