linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/2] btrfs: simplify the page uptodate preparation for prepare_pages()
Date: Wed, 2 Oct 2024 15:04:05 +0200	[thread overview]
Message-ID: <20241002130405.GJ28777@suse.cz> (raw)
In-Reply-To: <f6721e0c-efce-48e2-9bea-4d023d633ed0@gmx.com>

On Wed, Oct 02, 2024 at 06:41:58AM +0930, Qu Wenruo wrote:
> 
> 
> 在 2024/10/2 01:00, David Sterba 写道:
> > On Tue, Oct 01, 2024 at 08:17:11AM +0930, Qu Wenruo wrote:
> >> +	if (force_uptodate)
> >> +		goto read;
> >> +
> >> +	/* The dirty range fully cover the page, no need to read it out. */
> >> +	if (IS_ALIGNED(clamp_start, PAGE_SIZE) &&
> >> +	    IS_ALIGNED(clamp_end, PAGE_SIZE))
> >> +		return 0;
> >> +read:
> >
> > I've commented under v1 and will repeat it here so it does not get lost,
> > this if and goto is not necessary here and can be a normal if () { ...  }
> >
> 
> This is not that simple.
> 
> If @force_uptodate we need to read the folio no matter what, meanwhile
> if the range is not aligned, we also need to read the folio.
> 
> And the @force_uptodate check should go before the alignment check, thus
> I'm wondering if there is any better alternative.

if (!force_update) {
	/* The dirty range fully cover the page, no need to read it out. */
	if (IS_ALIGNED(clamp_start, PAGE_SIZE) &&
	    IS_ALIGNED(clamp_end, PAGE_SIZE))
		return 0;
}



      reply	other threads:[~2024-10-02 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 22:47 [PATCH v2 0/2] btrfs: small cleanups to buffered write path Qu Wenruo
2024-09-30 22:47 ` [PATCH v2 1/2] btrfs: remove the dirty_page local variable Qu Wenruo
2024-09-30 22:47 ` [PATCH v2 2/2] btrfs: simplify the page uptodate preparation for prepare_pages() Qu Wenruo
2024-10-01 15:30   ` David Sterba
2024-10-01 21:11     ` Qu Wenruo
2024-10-02 13:04       ` David Sterba [this message]

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=20241002130405.GJ28777@suse.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.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;
as well as URLs for NNTP newsgroup(s).