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 6/8] f2fs: simplify f2fs_force_buffered_io()
Date: Mon, 29 Aug 2022 10:36:10 -0700 [thread overview]
Message-ID: <Ywz5CrBg6udTMnW/@google.com> (raw)
In-Reply-To: <20220827065851.135710-7-ebiggers@kernel.org>
On 08/26, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> f2fs only allows direct I/O that is aligned to the filesystem block
> size. Given that fact, simplify f2fs_force_buffered_io() by removing
> the redundant call to block_unaligned_IO().
>
> This makes it easier to reuse this code for STATX_DIOALIGN.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/f2fs/file.c | 27 +++++----------------------
> 1 file changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 8a9455bf956f16..8e11311db21060 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -808,22 +808,9 @@ 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)
> +static bool f2fs_force_buffered_io(struct inode *inode, int rw)
> {
> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> - int rw = iov_iter_rw(iter);
>
> if (!fscrypt_dio_supported(inode))
> return true;
> @@ -836,13 +823,9 @@ static bool f2fs_force_buffered_io(struct inode *inode,
> 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))
> + if (f2fs_lfs_mode(sbi) && rw == WRITE && F2FS_IO_ALIGNED(sbi))
> + return true;
> + if (is_sbi_flag_set(sbi, SBI_CP_DISABLED))
> return true;
>
> return false;
> @@ -4222,7 +4205,7 @@ static bool f2fs_should_use_dio(struct inode *inode, struct kiocb *iocb,
> if (!(iocb->ki_flags & IOCB_DIRECT))
> return false;
>
> - if (f2fs_force_buffered_io(inode, iocb, iter))
> + if (f2fs_force_buffered_io(inode, iov_iter_rw(iter)))
> return false;
>
> /*
> --
> 2.37.2
next prev parent reply other threads:[~2022-08-29 17:36 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
2022-08-27 6:58 ` [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io() Eric Biggers
2022-08-29 17:36 ` Jaegeuk Kim [this message]
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=Ywz5CrBg6udTMnW/@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).