[PATCH 3/6] blk-merge: split bio by max_segment_size, not PAGE_SIZE
Hannes Reinecke
hare at kernel.org
Tue May 14 10:38:57 PDT 2024
Bvecs can be larger than a page, and the block layer handles
this just fine. So do not split by PAGE_SIZE but rather by
the max_segment_size if that happens to be larger.
Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
block/blk-merge.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 4e3483a16b75..570573d7a34f 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -278,6 +278,7 @@ struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
struct bio_vec bv, bvprv, *bvprvp = NULL;
struct bvec_iter iter;
unsigned nsegs = 0, bytes = 0;
+ unsigned bv_seg_lim = max(PAGE_SIZE, lim->max_segment_size);
bio_for_each_bvec(bv, bio, iter) {
/*
@@ -289,7 +290,7 @@ struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
if (nsegs < lim->max_segments &&
bytes + bv.bv_len <= max_bytes &&
- bv.bv_offset + bv.bv_len <= PAGE_SIZE) {
+ bv.bv_offset + bv.bv_len <= bv_seg_lim) {
nsegs++;
bytes += bv.bv_len;
} else {
--
2.35.3
More information about the Linux-nvme
mailing list