]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: remove duplicated root key setup in btrfs_create_tree()
authorFilipe Manana <fdmanana@suse.com>
Mon, 15 Dec 2025 18:36:32 +0000 (18:36 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:49:10 +0000 (07:49 +0100)
There's no need for an on stack key to define the root's key as we have
already defined the key in the root itself. So remove the stack variable
and use the key in the root.

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/disk-io.c

index 5d8dcaaf11fe296597310b84c75ade98d39fce94..7dea5615bd8fff3b8b0820838aad695d701fb58b 100644 (file)
@@ -802,7 +802,6 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
        struct extent_buffer *leaf;
        struct btrfs_root *tree_root = fs_info->tree_root;
        struct btrfs_root *root;
-       struct btrfs_key key;
        unsigned int nofs_flag;
        int ret = 0;
 
@@ -851,10 +850,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 
        btrfs_tree_unlock(leaf);
 
-       key.objectid = objectid;
-       key.type = BTRFS_ROOT_ITEM_KEY;
-       key.offset = 0;
-       ret = btrfs_insert_root(trans, tree_root, &key, &root->root_item);
+       ret = btrfs_insert_root(trans, tree_root, &root->root_key, &root->root_item);
        if (ret)
                goto fail;