linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, linux-api@vger.kernel.org,
	linux-fscrypt@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c
Date: Mon, 29 Aug 2022 10:37:15 -0700	[thread overview]
Message-ID: <Ywz5Sxu78GRJZUp5@google.com> (raw)
In-Reply-To: <20220827065851.135710-6-ebiggers@kernel.org>

On 08/26, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.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@google.com>

Acked-by: Jaegeuk Kim <jaegeuk@kernel.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

  reply	other threads:[~2022-08-29 17:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
2022-08-27  6:58 ` [PATCH v5 1/8] statx: add direct I/O " Eric Biggers
2022-09-07  9:10   ` Christian Brauner
2022-08-27  6:58 ` [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices Eric Biggers
2022-09-06  8:10   ` Christoph Hellwig
2022-09-07  9:09   ` Christian Brauner
2022-08-27  6:58 ` [PATCH v5 3/8] fscrypt: change fscrypt_dio_supported() to prepare for STATX_DIOALIGN Eric Biggers
2022-08-27  6:58 ` [PATCH v5 4/8] ext4: support STATX_DIOALIGN Eric Biggers
2022-08-27  6:58 ` [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c Eric Biggers
2022-08-29 17:37   ` Jaegeuk Kim [this message]
2022-08-27  6:58 ` [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io() Eric Biggers
2022-08-29 17:36   ` Jaegeuk Kim
2022-08-27  6:58 ` [PATCH v5 7/8] f2fs: support STATX_DIOALIGN Eric Biggers
2022-08-29 17:43   ` Jaegeuk Kim
2022-08-27  6:58 ` [PATCH v5 8/8] xfs: " Eric Biggers
2022-08-27 15:34   ` Darrick J. Wong
2022-09-06  8:11   ` Christoph Hellwig
2022-09-06 22:08 ` [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
2022-09-12  0:54   ` Eric Biggers
2022-09-12 20:30     ` Stephen Rothwell
2022-10-18  4:55       ` Stephen Rothwell
2022-10-18  7:07         ` Eric Biggers
2022-10-18 20:08           ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ywz5Sxu78GRJZUp5@google.com \
    --to=jaegeuk@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=kbusch@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).