Re: [PATCH] btrfs: more trivial BTRFS_PATH_AUTO_FREE conversions

David Sterba
2025-09-30T16:35:54Z

On Tue, Sep 30, 2025 at 01:09:07PM +0800, Sun YangKai wrote:
> Trivial pattern for the auto freeing without goto -> return conversions.
> No other function cleanup.
>
> Tested with btrfs/auto group.
>
> Signed-off-by: Sun YangKai <sunk67188@gmail.com>
> ---
> fs/btrfs/uuid-tree.c | 12 ++++--------
> fs/btrfs/verity.c | 9 +++------
> fs/btrfs/volumes.c | 44 ++++++++++++++------------------------------
> fs/btrfs/xattr.c | 7 ++-----
> 4 files changed, 23 insertions(+), 49 deletions(-)
>
> diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
> index 17b5e81123a1..30e5d80adda9 100644
> --- a/fs/btrfs/uuid-tree.c
> +++ b/fs/btrfs/uuid-tree.c
> @@ -27,7 +27,7 @@ static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, const u8 *uuid,
> u8 type, u64 subid)
> {
> int ret;
> - struct btrfs_path *path = NULL;
> + BTRFS_PATH_AUTO_FREE(path);
> struct extent_buffer *eb;
> int slot;
> u32 item_size;
> @@ -79,7 +79,6 @@ static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, const u8 *uuid,
> }
>
> out:
> - btrfs_free_path(path);

Here and in several other places you did not convert gotos to returns
and removed the out: label. What I've seen in other places in the patch
the conversions are straightforward and you already did that in other
patches. Can you please do it here as well?

The unnecessary gotos are in functions where the patch auto freeing is
not done, this could be another cleanup round.