]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
blk-crypto: handle the fallback above the block layer
authorChristoph Hellwig <hch@lst.de>
Fri, 9 Jan 2026 06:07:49 +0000 (07:07 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 11 Jan 2026 19:55:41 +0000 (12:55 -0700)
commitbb8e2019ad613dd023a59bf91d1768018d17e09b
tree2b82449366bbb591e549122b5bf9f4e02132a7df
parent66e5a11d2ed6d58006d5cd8276de28751daaa230
blk-crypto: handle the fallback above the block layer

Add a blk_crypto_submit_bio helper that either submits the bio when
it is not encrypted or inline encryption is provided, but otherwise
handles the encryption before going down into the low-level driver.
This reduces the risk from bio reordering and keeps memory allocation
as high up in the stack as possible.

Note that if the submitter knows that inline enctryption is known to
be supported by the underyling driver, it can still use plain
submit_bio.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 files changed:
Documentation/block/inline-encryption.rst
block/blk-core.c
block/blk-crypto-internal.h
block/blk-crypto.c
fs/buffer.c
fs/crypto/bio.c
fs/ext4/page-io.c
fs/ext4/readpage.c
fs/f2fs/data.c
fs/f2fs/file.c
fs/iomap/direct-io.c
include/linux/blk-crypto.h