[PATCH 06/22] btrfs-progs: mkfs: use the btrfs_block_group_root helper
From: Josef Bacik <josef@toxicpanda.com>
Date: 2021-11-05 20:41:00
Subsystem:
the rest · Maintainer:
Linus Torvalds
Instead of accessing the extent root directory for modifying block groups, use the helper which will do the correct thing based on the flags of the file system. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- check/main.c | 4 ++-- mkfs/main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/check/main.c b/check/main.c
index 5fb28216..7735cce1 100644
--- a/check/main.c
+++ b/check/main.c@@ -9387,6 +9387,7 @@ static int reinit_global_roots(struct btrfs_trans_handle *trans, u64 objectid) static int reinit_extent_tree(struct btrfs_trans_handle *trans, bool pin) { + struct btrfs_root *bg_root = btrfs_block_group_root(trans->fs_info); u64 start = 0; int ret;
@@ -9460,7 +9461,6 @@ again: while (1) { struct btrfs_block_group_item bgi; struct btrfs_block_group *cache; - struct btrfs_root *extent_root = btrfs_extent_root(gfs_info, 0); struct btrfs_key key; cache = btrfs_lookup_first_block_group(gfs_info, start);
@@ -9474,7 +9474,7 @@ again: key.objectid = cache->start; key.type = BTRFS_BLOCK_GROUP_ITEM_KEY; key.offset = cache->length; - ret = btrfs_insert_item(trans, extent_root, &key, &bgi, + ret = btrfs_insert_item(trans, bg_root, &key, &bgi, sizeof(bgi)); if (ret) { fprintf(stderr, "Error adding block group\n");
diff --git a/mkfs/main.c b/mkfs/main.c
index 2c4b7b00..9a57cef8 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c@@ -596,7 +596,7 @@ static int cleanup_temp_chunks(struct btrfs_fs_info *fs_info, { struct btrfs_trans_handle *trans = NULL; struct btrfs_block_group_item *bgi; - struct btrfs_root *root = btrfs_extent_root(fs_info, 0); + struct btrfs_root *root = btrfs_block_group_root(fs_info); struct btrfs_key key; struct btrfs_key found_key; struct btrfs_path path;
--
2.26.3