On Fri, Nov 13, 2020 at 11:43:48AM +0800, Lihong Kou wrote: > Now we have inline encrytion and fs layer encrption in the kernel, when we > choose inline encryption, we should not use bufferd IO instead of direct IO. > > Signed-off-by: Lihong Kou <koulihong@xxxxxxxxxx> > --- > fs/f2fs/f2fs.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index cb700d797296..ccc5c9734f55 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -3889,8 +3889,8 @@ static inline void f2fs_set_encrypted_inode(struct inode *inode) > */ > static inline bool f2fs_post_read_required(struct inode *inode) > { > - return f2fs_encrypted_file(inode) || fsverity_active(inode) || > - f2fs_compressed_file(inode); > + return (f2fs_encrypted_file(inode) && fscrypt_inode_uses_fs_layer_crypto(inode)) > + || fsverity_active(inode) || f2fs_compressed_file(inode); > } This isn't correct for upstream because upstream doesn't support direct I/O with fscrypt inline encryption yet. The patchset to support direct I/O with fscrypt inline encryption was last sent out at https://lkml.kernel.org/linux-fscrypt/20200720233739.824943-1-satyat@xxxxxxxxxx. I believe that Satya is planning to send it again soon. On the other hand, downstream, the Android common kernels have the fscrypt direct I/O support already, and f2fs_force_buffered_io() has been updated accordingly. If you're using one of the Android common kernels, can you make sure it's up-to-date? - Eric