From 3d47c0c8b57073b1389dd9c53291d81eb8951e18 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Mon, 15 Dec 2025 18:36:32 +0000 Subject: [PATCH] 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 Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5d8dcaaf11fe2..7dea5615bd8ff 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -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; -- 2.47.3