lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ywz5Sxu78GRJZUp5@google.com>
Date:   Mon, 29 Aug 2022 10:37:15 -0700
From:   Jaegeuk Kim <jaegeuk@...nel.org>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net, linux-xfs@...r.kernel.org,
        linux-api@...r.kernel.org, linux-fscrypt@...r.kernel.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        Keith Busch <kbusch@...nel.org>
Subject: Re: [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c

On 08/26, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
> 
> f2fs_force_buffered_io() is only used in file.c, so move it into there.
> No behavior change.  This makes it easier to review later patches.
> 
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>

Acked-by: Jaegeuk Kim <jaegeuk@...nel.org>

> ---
>  fs/f2fs/f2fs.h | 40 ----------------------------------------
>  fs/f2fs/file.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+), 40 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 0759da1919f4ad..aea816a133a8f1 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4471,17 +4471,6 @@ static inline void f2fs_i_compr_blocks_update(struct inode *inode,
>  	f2fs_mark_inode_dirty_sync(inode, true);
>  }
>  
> -static inline int block_unaligned_IO(struct inode *inode,
> -				struct kiocb *iocb, struct iov_iter *iter)
> -{
> -	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
> -	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
> -	loff_t offset = iocb->ki_pos;
> -	unsigned long align = offset | iov_iter_alignment(iter);
> -
> -	return align & blocksize_mask;
> -}
> -
>  static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi,
>  								int flag)
>  {
> @@ -4492,35 +4481,6 @@ static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi,
>  	return sbi->aligned_blksize;
>  }
>  
> -static inline bool f2fs_force_buffered_io(struct inode *inode,
> -				struct kiocb *iocb, struct iov_iter *iter)
> -{
> -	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> -	int rw = iov_iter_rw(iter);
> -
> -	if (!fscrypt_dio_supported(inode))
> -		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 */
> -	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
> -		return true;
> -
> -	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
> -		if (block_unaligned_IO(inode, iocb, iter))
> -			return true;
> -		if (F2FS_IO_ALIGNED(sbi))
> -			return true;
> -	}
> -	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
> -		return true;
> -
> -	return false;
> -}
> -
>  static inline bool f2fs_need_verity(const struct inode *inode, pgoff_t idx)
>  {
>  	return fsverity_active(inode) &&
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index ce4905a073b3c4..8a9455bf956f16 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -808,6 +808,46 @@ int f2fs_truncate(struct inode *inode)
>  	return 0;
>  }
>  
> +static int block_unaligned_IO(struct inode *inode, struct kiocb *iocb,
> +			      struct iov_iter *iter)
> +{
> +	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
> +	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
> +	loff_t offset = iocb->ki_pos;
> +	unsigned long align = offset | iov_iter_alignment(iter);
> +
> +	return align & blocksize_mask;
> +}
> +
> +static bool f2fs_force_buffered_io(struct inode *inode,
> +				   struct kiocb *iocb, struct iov_iter *iter)
> +{
> +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> +	int rw = iov_iter_rw(iter);
> +
> +	if (!fscrypt_dio_supported(inode))
> +		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 */
> +	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
> +		return true;
> +
> +	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
> +		if (block_unaligned_IO(inode, iocb, iter))
> +			return true;
> +		if (F2FS_IO_ALIGNED(sbi))
> +			return true;
> +	}
> +	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
> +		return true;
> +
> +	return false;
> +}
> +
>  int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
>  		 struct kstat *stat, u32 request_mask, unsigned int query_flags)
>  {
> -- 
> 2.37.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ