From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Eric Biggers <ebiggers@google.com>,
Keith Busch <kbusch@kernel.org>,
Christop Hellwig <hch@infradead.org>,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH 1/3] block: Split blk_crypto_fallback_split_bio_if_needed()
Date: Wed, 25 Jun 2025 16:42:57 -0700 [thread overview]
Message-ID: <20250625234259.1985366-2-bvanassche@acm.org> (raw)
In-Reply-To: <20250625234259.1985366-1-bvanassche@acm.org>
Prepare for calling blk_crypto_max_io_size() from the bio splitting code.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-crypto-fallback.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c
index 005c9157ffb3..323f59b91a8f 100644
--- a/block/blk-crypto-fallback.c
+++ b/block/blk-crypto-fallback.c
@@ -209,9 +209,12 @@ blk_crypto_fallback_alloc_cipher_req(struct blk_crypto_keyslot *slot,
return true;
}
-static bool blk_crypto_fallback_split_bio_if_needed(struct bio **bio_ptr)
+/*
+ * The encryption fallback code allocates bounce pages individually. Hence this
+ * function that calculates an upper limit for the bio size.
+ */
+static unsigned int blk_crypto_max_io_size(struct bio *bio)
{
- struct bio *bio = *bio_ptr;
unsigned int i = 0;
unsigned int num_sectors = 0;
struct bio_vec bv;
@@ -222,6 +225,16 @@ static bool blk_crypto_fallback_split_bio_if_needed(struct bio **bio_ptr)
if (++i == BIO_MAX_VECS)
break;
}
+
+ return num_sectors;
+}
+
+static bool blk_crypto_fallback_split_bio_if_needed(struct bio **bio_ptr)
+{
+ struct bio *bio = *bio_ptr;
+ unsigned int num_sectors;
+
+ num_sectors = blk_crypto_max_io_size(bio);
if (num_sectors < bio_sectors(bio)) {
struct bio *split_bio;
next prev parent reply other threads:[~2025-06-25 23:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 23:42 [PATCH 0/3] Fix bio splitting in the crypto fallback code Bart Van Assche
2025-06-25 23:42 ` Bart Van Assche [this message]
2025-06-25 23:42 ` [PATCH 2/3] block: Introduce the BLK_FEAT_CALLS_BIO_SPLIT_TO_LIMITS flag Bart Van Assche
2025-06-26 5:24 ` Christop Hellwig
2025-06-25 23:42 ` [PATCH 3/3] block: Rework splitting of encrypted bios Bart Van Assche
2025-06-26 5:28 ` Christop Hellwig
2025-07-10 18:04 ` Bart Van Assche
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=20250625234259.1985366-2-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=ebiggers@google.com \
--cc=hch@infradead.org \
--cc=kbusch@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.