From: "Darrick J. Wong" <djwong@kernel.org>
To: Gou Hao <gouhao@uniontech.com>
Cc: brauner@kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
wangyuli@uniontech.com, gouhaojake@163.com
Subject: Re: [PATCH] iomap: skip unnecessary ifs_block_is_uptodate check
Date: Wed, 9 Apr 2025 08:30:20 -0700 [thread overview]
Message-ID: <20250409153020.GR6283@frogsfrogsfrogs> (raw)
In-Reply-To: <20250408172924.9349-1-gouhao@uniontech.com>
On Wed, Apr 09, 2025 at 01:29:24AM +0800, Gou Hao wrote:
> After the first 'for' loop, the first call to
> ifs_block_is_uptodate always evaluates to 0.
>
> Signed-off-by: Gou Hao <gouhao@uniontech.com>
> ---
> fs/iomap/buffered-io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 31553372b33a..2f52e8e61240 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -259,7 +259,7 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio,
> }
>
> /* truncate len if we find any trailing uptodate block(s) */
> - for ( ; i <= last; i++) {
> + for (i++; i <= last; i++) {
Hmmm... prior to the loop, $i is either the first !uptodate block, or
it's past $last. Assuming there's no overflow (there's no combination
of huge folios and tiny blksize that I can think of) then yeah, there's
no point in retesting that the same block $i is uptodate since we hold
the folio lock so nobody else could have set uptodate.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> if (ifs_block_is_uptodate(ifs, i)) {
> plen -= (last - i + 1) * block_size;
> last = i - 1;
> --
> 2.20.1
>
>
next prev parent reply other threads:[~2025-04-09 15:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 17:29 [PATCH] iomap: skip unnecessary ifs_block_is_uptodate check Gou Hao
2025-04-09 15:30 ` Darrick J. Wong [this message]
2025-04-10 5:37 ` Gou Hao
2025-04-10 5:42 ` [PATCH V2] " Gou Hao
2025-04-10 5:54 ` Christoph Hellwig
2025-04-10 6:25 ` Gou Hao
2025-04-10 7:12 ` [PATCH V3] " Gou Hao
2025-04-10 7:17 ` Christoph Hellwig
2025-04-11 14:02 ` Christian Brauner
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=20250409153020.GR6283@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=brauner@kernel.org \
--cc=gouhao@uniontech.com \
--cc=gouhaojake@163.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=wangyuli@uniontech.com \
/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