btrfs: remove duplicated root key setup in btrfs_create_tree()

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>
This commit is contained in:
Filipe Manana 2025-12-15 18:36:32 +00:00 committed by David Sterba
parent 4273db18a8
commit 3d47c0c8b5

View 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;