blk-crypto: relax alignment requirements for bvecs in bios

In order to support direct I/O on encrypted files as well as possibly
other future use cases such as filesystem metadata encryption, we need
to relax the restriction that if a bio has an encryption context, then
all its bvecs must be be aligned to the encryption context's data unit
size.  Instead we'll just require that the bio's total size be aligned
to the data unit size (in addition to the usual logical_block_size
alignment requirement on bvecs).

Now that the rest of the block layer has been updated to be compatible
with the new requirements, update __blk_crypto_bio_prep() accordingly to
just validate the alignment of the total size.

Co-developed-by: Eric Biggers <>
Signed-off-by: Eric Biggers <>
Signed-off-by: Satya Tangirala <>
1 file changed