]> git.ipfire.org Git - people/ms/linux.git/commit - fs/iomap/direct-io.c
iomap: support direct I/O with fscrypt using blk-crypto
authorEric Biggers <ebiggers@google.com>
Fri, 28 Jan 2022 23:39:37 +0000 (15:39 -0800)
committerEric Biggers <ebiggers@google.com>
Tue, 8 Feb 2022 19:02:07 +0000 (11:02 -0800)
commit489734ef94f4f78087e103ef1bd9019968ff8dbd
tree7f8b11179d2fff7c2ccba4b75ff6699f6377feda
parentc6c89783eba05a5e159b07cfd8c68d841cc5de42
iomap: support direct I/O with fscrypt using blk-crypto

Encrypted files traditionally haven't supported DIO, due to the need to
encrypt/decrypt the data.  However, when the encryption is implemented
using inline encryption (blk-crypto) instead of the traditional
filesystem-layer encryption, it is straightforward to support DIO.

Add support for this to the iomap DIO implementation by calling
fscrypt_set_bio_crypt_ctx() to set encryption contexts on the bios.

Don't check for the rare case where a DUN (crypto data unit number)
discontiguity creates a boundary that bios must not cross.  Instead,
filesystems are expected to handle this in ->iomap_begin() by limiting
the length of the mapping so that iomap doesn't have to worry about it.

Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220128233940.79464-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
fs/iomap/direct-io.c