From: David Sterba <dsterba@suse.cz>
To: Daniel Vacek <neelx@suse.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: get rid of goto in alloc_test_extent_buffer()
Date: Fri, 25 Apr 2025 13:39:07 +0200 [thread overview]
Message-ID: <20250425113907.GC31681@suse.cz> (raw)
In-Reply-To: <20250425072358.51788-1-neelx@suse.com>
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@suse.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@suse.com>
next prev parent reply other threads:[~2025-04-25 11:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 7:23 [PATCH] btrfs: get rid of goto in alloc_test_extent_buffer() Daniel Vacek
2025-04-25 11:39 ` David Sterba [this message]
2025-04-30 14:23 ` 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=20250425113907.GC31681@suse.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neelx@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