blob: d2372a9da7b42d1d158be390d2cd108c03e51698 [file] [log] [blame]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Eric Biggers <ebiggers@google.com>
Date: Fri, 24 Jul 2020 18:44:59 +0000
Subject: ANDROID: f2fs: support direct I/O with fscrypt using blk-crypto
Wire up f2fs with fscrypt direct I/O support. direct I/O with fscrypt is
only supported through blk-crypto (i.e. CONFIG_BLK_INLINE_ENCRYPTION must
have been enabled, the 'inlinecrypt' mount option must have been specified,
and either hardware inline encryption support must be present or
CONFIG_BLK_INLINE_ENCYRPTION_FALLBACK must have been enabled). Further,
direct I/O on encrypted files is only supported when I/O is aligned
to the filesystem block size (which is *not* necessarily the same as the
block device's block size).
[CPNOTE: 25/05/21] Lee: No update since v8 was posted in January - poked the MLs
[CPNOTE: 26/05/21] Lee: Satya will work to push these forward over the next week
[CPNOTE: 22/07/21] Lee: v9 was posted 7 weeks ago with no reviews - poked again
[CPNOTE: 04/08/21] Lee: Eric and Satya are still working on this [0]
[0] https://lore.kernel.org/linux-xfs/YPmFSw4JbWnIozSZ@gmail.com/
Signed-off-by: Eric Biggers <ebiggers@google.com>
Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bug: 162255927
Link: https://lore.kernel.org/r/20200724184501.1651378-6-satyat@google.com
Change-Id: I2efde5aed559ba59f964d7d2e54f73414062daf8
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/f2fs/f2fs.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4346,7 +4346,11 @@ static inline bool f2fs_force_buffered_io(struct inode *inode,
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
int rw = iov_iter_rw(iter);
- if (f2fs_post_read_required(inode))
+ if (!fscrypt_dio_supported(iocb, iter))
+ return true;
+ if (fsverity_active(inode))
+ return true;
+ if (f2fs_compressed_file(inode))
return true;
/* disallow direct IO if any of devices has unaligned blksize */