[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250430142335.GI9140@twin.jikos.cz>
Date: Wed, 30 Apr 2025 16:23:35 +0200
From: David Sterba <dsterba@...e.cz>
To: David Sterba <dsterba@...e.cz>
Cc: Daniel Vacek <neelx@...e.com>, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>, David Sterba <dsterba@...e.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: get rid of goto in alloc_test_extent_buffer()
On Fri, Apr 25, 2025 at 01:39:07PM +0200, David Sterba wrote:
> On Fri, Apr 25, 2025 at 09:23:57AM +0200, Daniel Vacek wrote:
> > The `free_eb` label is used only once. Simplify by moving the code inplace.
> >
> > Signed-off-by: Daniel Vacek <neelx@...e.com>
> > ---
> > fs/btrfs/extent_io.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> > index ea38c73d4bc5f..20cdddd924852 100644
> > --- a/fs/btrfs/extent_io.c
> > +++ b/fs/btrfs/extent_io.c
> > @@ -3004,15 +3004,13 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
> > goto again;
> > }
> > xa_unlock_irq(&fs_info->buffer_tree);
> > - goto free_eb;
> > + btrfs_release_extent_buffer(eb);
> > + return exists;
> > }
> > xa_unlock_irq(&fs_info->buffer_tree);
> > check_buffer_tree_ref(eb);
> >
> > return eb;
> > -free_eb:
> > - btrfs_release_extent_buffer(eb);
>
> So the xarray conversion removed the other use of the free_eb label and
> calls btrfs_release_extent_buffer() + return. Doing the same here and
> removing the label completely looks as an improvement, as the whole
> function does direct returns instead of goto exit block.
>
> Reviewed-by: David Sterba <dsterba@...e.com>
Xarray conversion is now in for-next so I've added this patch too.
Powered by blists - more mailing lists