btrfs-progs: mkfs: refactor create_data_reloc_tree
Add an objectid parameter to make the function a general one for inserting root items and rename it to create_tree. The change cascades down to the callchain. Signed-off-by: yingyil <yingyil@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
bcaadc2e49
commit
f7267bc85c
|
@ -321,13 +321,12 @@ static int create_raid_groups(struct btrfs_trans_handle *trans,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create_data_reloc_tree(struct btrfs_trans_handle *trans,
|
static int create_tree(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root)
|
struct btrfs_root *root, u64 objectid)
|
||||||
{
|
{
|
||||||
struct btrfs_key location;
|
struct btrfs_key location;
|
||||||
struct btrfs_root_item root_item;
|
struct btrfs_root_item root_item;
|
||||||
struct extent_buffer *tmp;
|
struct extent_buffer *tmp;
|
||||||
u64 objectid = BTRFS_DATA_RELOC_TREE_OBJECTID;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = btrfs_copy_root(trans, root, root->node, &tmp, objectid);
|
ret = btrfs_copy_root(trans, root, root->node, &tmp, objectid);
|
||||||
|
@ -1857,7 +1856,7 @@ raid_groups:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = create_data_reloc_tree(trans, root);
|
ret = create_tree(trans, root, BTRFS_DATA_RELOC_TREE_OBJECTID);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error("unable to create data reloc tree: %d", ret);
|
error("unable to create data reloc tree: %d", ret);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue