diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-22 19:50:16 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-22 19:50:16 +0300 |
commit | 881b568756ae55ce7d87b9f001cbbe9d1289893e (patch) | |
tree | ef01162f9685a0560e6a732f62203140924d315b /fs/f2fs/data.c | |
parent | 0313bc278dac7cd9ce83a8d384581dc043156965 (diff) | |
parent | cdaa1b1941f667814300799ddb74f3079517cd5a (diff) | |
download | linux-881b568756ae55ce7d87b9f001cbbe9d1289893e.tar.xz |
Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt
Pull fscrypt updates from Eric Biggers:
"Add support for direct I/O on encrypted files when blk-crypto (inline
encryption) is being used for file contents encryption"
* tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
fscrypt: update documentation for direct I/O support
f2fs: support direct I/O with fscrypt using blk-crypto
ext4: support direct I/O with fscrypt using blk-crypto
iomap: support direct I/O with fscrypt using blk-crypto
fscrypt: add functions for direct I/O support
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index fc077bce679d..79c9ed74bd8b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -4032,6 +4032,13 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, iomap->offset = blks_to_bytes(inode, map.m_lblk); + /* + * When inline encryption is enabled, sometimes I/O to an encrypted file + * has to be broken up to guarantee DUN contiguity. Handle this by + * limiting the length of the mapping returned. + */ + map.m_len = fscrypt_limit_io_blocks(inode, map.m_lblk, map.m_len); + if (map.m_flags & (F2FS_MAP_MAPPED | F2FS_MAP_UNWRITTEN)) { iomap->length = blks_to_bytes(inode, map.m_len); if (map.m_flags & F2FS_MAP_MAPPED) { |