[5/5] f2fs: support direct I/O with fscrypt using blk-crypto
diff mbox series

Message ID 20200709194751.2579207-6-satyat@google.com
State Superseded
Headers show
Series
  • add support for direct I/O with fscrypt using blk-crypto
Related show

Commit Message

Satya Tangirala July 9, 2020, 7:47 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Wire up f2fs with fscrypt direct I/O support.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
---
 fs/f2fs/f2fs.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Chao Yu July 10, 2020, 1:05 a.m. UTC | #1
On 2020/7/10 3:47, Satya Tangirala wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Wire up f2fs with fscrypt direct I/O support.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> Signed-off-by: Satya Tangirala <satyat@google.com>
> ---
>  fs/f2fs/f2fs.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index b35a50f4953c..6d662a37b445 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4082,7 +4082,9 @@ 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))

static inline bool f2fs_post_read_required(struct inode *inode)
{
	return f2fs_encrypted_file(inode) || fsverity_active(inode) ||
		f2fs_compressed_file(inode);
}

That's not correct, missed to check compression condition.

>  		return true;
>  	if (f2fs_is_multi_device(sbi))
>  		return true;
>
Eric Biggers July 10, 2020, 1:15 a.m. UTC | #2
On Fri, Jul 10, 2020 at 09:05:23AM +0800, Chao Yu wrote:
> On 2020/7/10 3:47, Satya Tangirala wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > Wire up f2fs with fscrypt direct I/O support.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > Signed-off-by: Satya Tangirala <satyat@google.com>
> > ---
> >  fs/f2fs/f2fs.h | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index b35a50f4953c..6d662a37b445 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -4082,7 +4082,9 @@ 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))
> 
> static inline bool f2fs_post_read_required(struct inode *inode)
> {
> 	return f2fs_encrypted_file(inode) || fsverity_active(inode) ||
> 		f2fs_compressed_file(inode);
> }
> 
> That's not correct, missed to check compression condition.
> 

Thanks Chao, great catch.  This used to be correct, but we missed that the
second f2fs_compressed_file() check got removed by commit b5f4684b5f5f
("f2fs: remove redundant compress inode check").

- Eric

Patch
diff mbox series

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index b35a50f4953c..6d662a37b445 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4082,7 +4082,9 @@  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_is_multi_device(sbi))
 		return true;