public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Boris Burkov <boris@bur.io>
Cc: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs: add helper folio_end()
Date: Wed, 4 Jun 2025 00:46:01 +0200	[thread overview]
Message-ID: <20250603224601.GR4037@twin.jikos.cz> (raw)
In-Reply-To: <20250603185442.GA2633115@zen.localdomain>

On Tue, Jun 03, 2025 at 11:54:42AM -0700, Boris Burkov wrote:
> > --- a/fs/btrfs/defrag.c
> > +++ b/fs/btrfs/defrag.c
> > @@ -849,7 +849,7 @@ static struct folio *defrag_prepare_one_folio(struct btrfs_inode *inode, pgoff_t
> >  	struct address_space *mapping = inode->vfs_inode.i_mapping;
> >  	gfp_t mask = btrfs_alloc_write_mask(mapping);
> >  	u64 folio_start;
> > -	u64 folio_end;
> > +	u64 folio_last;
> 
> This is nitpicky, but I think introducing the new word "last" in in an
> inconsistent fashion is a mistake.
> 
> In patch 2 at truncate_block_zero_beyond_eof()

In truncate_block_zero_beyond_eof if zero_end is folio_end() exactly
then we don't have to do "zero_end - zero_start + 1" in the length
parameter of folio_zero_range() as the -1 and +1 cancel out.

> and btrfs_writepage_fixup_worker,

Here the page_start and page_end are passed to the extent locking where
the end of the range is "-1" but from what I've seen we're using the
"end" in the variable names.

To avoid confusion I'd rename the folio_start and folio_end in
defrag_prepare_one_folio to lock_start and lock_end so the _last
semantic for ranges does exist.

> you have variables called "X_end" that get
> assigned to folio_end() - 1. Either those should also get called
> "X_last" or this one should have "end" in its name.

  parent reply	other threads:[~2025-06-03 22:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03  8:16 [PATCH 0/2] Folio pos + size cleanups David Sterba
2025-06-03  8:16 ` [PATCH 1/2] btrfs: add helper folio_end() David Sterba
2025-06-03 18:54   ` Boris Burkov
2025-06-03 19:36     ` David Sterba
2025-06-03 20:21       ` Boris Burkov
2025-06-03 22:46     ` David Sterba [this message]
2025-06-03  8:16 ` [PATCH 2/2] btrfs: use folio_end() where appropriate David Sterba

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=20250603224601.GR4037@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@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