]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: remove pointless out label from add_new_free_space_info()
authorFilipe Manana <fdmanana@suse.com>
Wed, 11 Jun 2025 11:06:57 +0000 (12:06 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:58:01 +0000 (23:58 +0200)
We can just return directly if btrfs_insert_empty_item() fails, there is
no need to release the path before returning, as all callers (or upper
in the call chain) will free the path if they get an error from the call
to add_new_free_space_info(), which is also a common pattern everywhere
in btrfs. Finally there's no need to set 'ret' to 0 if the call to
btrfs_insert_empty_item() didn't fail, since 'ret' is already 0.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/free-space-tree.c

index f03f3610b7131904ef9d80a6ac3cea79120a5294..6418b3b5d16aa9f939d1f2ee73a81fd9a1327038 100644 (file)
@@ -82,18 +82,15 @@ static int add_new_free_space_info(struct btrfs_trans_handle *trans,
 
        ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*info));
        if (ret)
-               goto out;
+               return ret;
 
        leaf = path->nodes[0];
        info = btrfs_item_ptr(leaf, path->slots[0],
                              struct btrfs_free_space_info);
        btrfs_set_free_space_extent_count(leaf, info, 0);
        btrfs_set_free_space_flags(leaf, info, 0);
-
-       ret = 0;
-out:
        btrfs_release_path(path);
-       return ret;
+       return 0;
 }
 
 EXPORT_FOR_TESTS