On Wed, Dec 17, 2025 at 07:06:51AM +0100, Christoph Hellwig wrote:
> Avoid the relatively high overhead of constructing and walking per-page
> segment bio_vecs for data unit alignment checking by merging the checks
> into existing loops.
> 
> For hardware support crypto, perform the check in bio_split_io_at, which
> already contains a similar alignment check applied for all I/O.  This
> means bio-based drivers that do not call bio_split_to_limits, should they
> ever grow blk-crypto support, need to implement the check themselves,
> just like all other queue limits checks.
> 
> For blk-crypto-fallback do it in the encryption/decryption loops.  This
> means alignment errors for decryption will only be detected after I/O
> has completed, but that seems like a worthwhile trade off.
> 
> Signed-off-by: Christoph Hellwig <[email protected]>
> ---
>  block/blk-crypto-fallback.c | 14 ++++++++++++--
>  block/blk-crypto.c          | 22 ----------------------
>  block/blk-merge.c           |  9 ++++++++-
>  3 files changed, 20 insertions(+), 25 deletions(-)

Reviewed-by: Eric Biggers <[email protected]>

- Eric

Reply via email to