From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: [PATCH 3/5] block: move the call to get_max_io_size out of blk_bio_segment_split
Date: Wed, 20 Jul 2022 16:24:54 +0200 [thread overview]
Message-ID: <20220720142456.1414262-4-hch@lst.de> (raw)
In-Reply-To: <20220720142456.1414262-1-hch@lst.de>
Prepare for reusing blk_bio_segment_split for (file system controlled)
splits of REQ_OP_ZONE_APPEND bios by letting the caller control the
maximum size of the bio.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-merge.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/block/blk-merge.c b/block/blk-merge.c
index e657f1dc824cb..1676a835b16e7 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -252,11 +252,12 @@ static bool bvec_split_segs(const struct request_queue *q,
* @bio: [in] bio to be split
* @bs: [in] bio set to allocate the clone from
* @segs: [out] number of segments in the bio with the first half of the sectors
+ * @max_bytes: [in] maximum number of bytes per bio
*
* Clone @bio, update the bi_iter of the clone to represent the first sectors
* of @bio and update @bio->bi_iter to represent the remaining sectors. The
* following is guaranteed for the cloned bio:
- * - That it has at most get_max_io_size(@q, @bio) sectors.
+ * - That it has at most @max_bytes worth of data
* - That it has at most queue_max_segments(@q) segments.
*
* Except for discard requests the cloned bio will point at the bi_io_vec of
@@ -266,14 +267,12 @@ static bool bvec_split_segs(const struct request_queue *q,
* split bio has finished.
*/
static struct bio *blk_bio_segment_split(struct request_queue *q,
- struct bio *bio,
- struct bio_set *bs,
- unsigned *segs)
+ struct bio *bio, struct bio_set *bs, unsigned *segs,
+ unsigned max_bytes)
{
struct bio_vec bv, bvprv, *bvprvp = NULL;
struct bvec_iter iter;
unsigned nsegs = 0, bytes = 0;
- const unsigned max_bytes = get_max_io_size(q, bio) << 9;
const unsigned max_segs = queue_max_segments(q);
bio_for_each_bvec(bv, bio, iter) {
@@ -347,7 +346,8 @@ void __blk_queue_split(struct request_queue *q, struct bio **bio,
split = blk_bio_write_zeroes_split(q, *bio, bs, nr_segs);
break;
default:
- split = blk_bio_segment_split(q, *bio, bs, nr_segs);
+ split = blk_bio_segment_split(q, *bio, bs, nr_segs,
+ get_max_io_size(q, *bio) << SECTOR_SHIFT);
break;
}
--
2.30.2
next prev parent reply other threads:[~2022-07-20 14:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 14:24 bio splitting cleanups Christoph Hellwig
2022-07-20 14:24 ` [PATCH 1/5] block: move ->bio_split to the gendisk Christoph Hellwig
2022-07-22 5:56 ` Damien Le Moal
2022-07-22 6:00 ` Christoph Hellwig
2022-07-20 14:24 ` [PATCH 2/5] block: fix max_zone_append_sectors inheritance in blk_stack_limits Christoph Hellwig
2022-07-22 5:59 ` Damien Le Moal
2022-07-22 6:03 ` Christoph Hellwig
2022-07-20 14:24 ` Christoph Hellwig [this message]
2022-07-22 6:09 ` [PATCH 3/5] block: move the call to get_max_io_size out of blk_bio_segment_split Damien Le Moal
2022-07-22 6:11 ` Christoph Hellwig
2022-07-22 6:12 ` Damien Le Moal
2022-07-20 14:24 ` [PATCH 4/5] block: move bio_allowed_max_sectors to blk-merge.c Christoph Hellwig
2022-07-21 6:31 ` Johannes Thumshirn
2022-07-21 6:42 ` Christoph Hellwig
2022-07-21 6:42 ` Johannes Thumshirn
2022-07-22 6:02 ` Damien Le Moal
2022-07-20 14:24 ` [PATCH 5/5] block: pass struct queue_limits to the bio splitting helpers Christoph Hellwig
2022-07-22 6:08 ` Damien Le Moal
2022-07-21 6:33 ` bio splitting cleanups Johannes Thumshirn
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=20220720142456.1414262-4-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.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