[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251113085403.GI13846@twin.jikos.cz>
Date: Thu, 13 Nov 2025 09:54:03 +0100
From: David Sterba <dsterba@...e.cz>
To: Qu Wenruo <quwenruo.btrfs@....com>
Cc: Gladyshev Ilya <foxido@...ido.dev>, Chris Mason <clm@...com>,
David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 7/8] btrfs: simplify return path via cleanup.h
On Thu, Nov 13, 2025 at 07:20:01AM +1030, Qu Wenruo wrote:
> > --- a/fs/btrfs/extent-tree.c
> > +++ b/fs/btrfs/extent-tree.c
> > @@ -1878,16 +1878,14 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans,
> > * and then re-check to make sure nobody got added.
> > */
> > spin_unlock(&head->lock);
> > - spin_lock(&delayed_refs->lock);
> > - spin_lock(&head->lock);
> > - if (!RB_EMPTY_ROOT(&head->ref_tree.rb_root) || head->extent_op) {
> > - spin_unlock(&head->lock);
> > - spin_unlock(&delayed_refs->lock);
> > - return 1;
> > + {
>
> There are some internal discussion about such anonymous code block usage.
>
> Although I support such usage, especially when it can reduce the
> lifespan of local variables, it's not a commonly accepted pattern yet.
And the discussion is going great, I think we wont't find a consensus
without somebody either missing a coding pattern (you) or suffering to
look at such code each time (me). Others have similar mixed feelings
about the guards use.
Powered by blists - more mailing lists