Skip to content

Commit 09324d3

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: force an unlimited segment size on queues with a virt boundary
We currently fail to update the front/back segment size in the bio when deciding to allow an otherwise gappy segement to a device with a virt boundary. The reason why this did not cause problems is that devices with a virt boundary fundamentally don't use segments as we know it and thus don't care. Make that assumption formal by forcing an unlimited segement size in this case. Fixes: f6970f8 ("block: don't check if adjacent bvecs in one bio can be mergeable") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent eded341 commit 09324d3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

block/blk-settings.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size)
310310
__func__, max_size);
311311
}
312312

313+
/* see blk_queue_virt_boundary() for the explanation */
314+
WARN_ON_ONCE(q->limits.virt_boundary_mask);
315+
313316
q->limits.max_segment_size = max_size;
314317
}
315318
EXPORT_SYMBOL(blk_queue_max_segment_size);
@@ -742,6 +745,14 @@ EXPORT_SYMBOL(blk_queue_segment_boundary);
742745
void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask)
743746
{
744747
q->limits.virt_boundary_mask = mask;
748+
749+
/*
750+
* Devices that require a virtual boundary do not support scatter/gather
751+
* I/O natively, but instead require a descriptor list entry for each
752+
* page (which might not be idential to the Linux PAGE_SIZE). Because
753+
* of that they are not limited by our notion of "segment size".
754+
*/
755+
q->limits.max_segment_size = UINT_MAX;
745756
}
746757
EXPORT_SYMBOL(blk_queue_virt_boundary);
747758

0 commit comments

Comments
 (0)