linux/fs/crypto
Eric Biggers c6c89783eb fscrypt: add functions for direct I/O support
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.

In preparation for supporting this, add the following functions:

- fscrypt_dio_supported() checks whether a DIO request is supported as
  far as encryption is concerned.  Encrypted files will only support DIO
  when inline encryption is used and the I/O request is properly
  aligned; this function checks these preconditions.

- fscrypt_limit_io_blocks() limits the length of a bio to avoid crossing
  a place in the file that a bio with an encryption context cannot
  cross due to a DUN discontiguity.  This function is needed by
  filesystems that use the iomap DIO implementation (which operates
  directly on logical ranges, so it won't use fscrypt_mergeable_bio())
  and that support FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32.

Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220128233940.79464-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-02-08 11:02:04 -08:00
..
bio.c fscrypt: clean up comments in bio.c 2021-09-20 19:32:34 -07:00
crypto.c fscrypt: add functions for direct I/O support 2022-02-08 11:02:04 -08:00
fname.c fscrypt: remove fscrypt_operations::max_namelen 2021-09-20 19:32:33 -07:00
fscrypt_private.h fscrypt: improve a few comments 2021-10-25 19:11:50 -07:00
hkdf.c fscrypt: allow 256-bit master keys with AES-256-XTS 2021-09-22 11:29:38 -07:00
hooks.c fscrypt: add fscrypt_symlink_getattr() for computing st_size 2021-07-25 20:01:06 -07:00
inline_crypt.c fscrypt: add functions for direct I/O support 2022-02-08 11:02:04 -08:00
Kconfig fscrypt: relax Kconfig dependencies for crypto API algorithms 2021-04-22 17:31:32 +10:00
keyring.c fscrypt: simplify master key locking 2020-11-24 15:29:47 -08:00
keysetup_v1.c fscrypt: stop pretending that key setup is nofs-safe 2020-09-22 06:48:42 -07:00
keysetup.c fscrypt: improve a few comments 2021-10-25 19:11:50 -07:00
Makefile fscrypt: add inline encryption support 2020-07-08 10:29:30 -07:00
policy.c inode: make init and permission helpers idmapped mount aware 2021-01-24 14:27:16 +01:00