From: Hannes Reinecke <hare@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Matthew Wilcox <willy@infradead.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Pankaj Raghav <p.raghav@samsung.com>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
Hannes Reinecke <hare@kernel.org>
Subject: [PATCH 3/6] blk-merge: split bio by max_segment_size, not PAGE_SIZE
Date: Tue, 14 May 2024 19:38:57 +0200 [thread overview]
Message-ID: <20240514173900.62207-4-hare@kernel.org> (raw)
In-Reply-To: <20240514173900.62207-1-hare@kernel.org>
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@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
next prev parent reply other threads:[~2024-05-14 17:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 17:38 [PATCHv2 0/6] enable bs > ps for block devices Hannes Reinecke
2024-05-14 17:38 ` [PATCH 1/6] fs/mpage: avoid negative shift for large blocksize Hannes Reinecke
2024-05-14 17:38 ` [PATCH 2/6] fs/mpage: use blocks_per_folio instead of blocks_per_page Hannes Reinecke
2024-05-14 17:38 ` Hannes Reinecke [this message]
2024-05-15 0:20 ` [PATCH 3/6] blk-merge: split bio by max_segment_size, not PAGE_SIZE John Garry
2024-05-15 12:29 ` Hannes Reinecke
2024-05-15 12:32 ` Hannes Reinecke
2024-05-15 15:21 ` John Garry
2024-05-14 17:38 ` [PATCH 4/6] block/bdev: enable large folio support for large logical block sizes Hannes Reinecke
2024-05-15 4:21 ` kernel test robot
2024-05-14 17:38 ` [PATCH 5/6] block/bdev: lift restrictions on supported blocksize Hannes Reinecke
2024-05-15 1:03 ` kernel test robot
2024-05-15 4:00 ` kernel test robot
2024-05-14 17:39 ` [PATCH 6/6] nvme: enable logical block size > PAGE_SIZE Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240514173900.62207-4-hare@kernel.org \
--to=hare@kernel.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mcgrof@kernel.org \
--cc=p.raghav@samsung.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).