All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 06/22] btrfs-progs: mkfs: use the btrfs_block_group_root helper
Date: Fri,  5 Nov 2021 16:40:32 -0400	[thread overview]
Message-ID: <742e40465dc7ab1c055900a0468a059c77be5087.1636144275.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1636144275.git.josef@toxicpanda.com>

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


  parent reply	other threads:[~2021-11-05 20:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 20:40 [PATCH 00/22] btrfs-progs: extent tree v2 support, global roots Josef Bacik
2021-11-05 20:40 ` [PATCH 01/22] btrfs-progs: common: allow users to select extent-tree-v2 option Josef Bacik
2021-11-05 20:40 ` [PATCH 02/22] btrfs-progs: add definitions for the block group tree Josef Bacik
2021-11-05 20:40 ` [PATCH 03/22] btrfs-progs: add on disk pointers to global tree ids Josef Bacik
2021-11-05 20:40 ` [PATCH 04/22] btrfs-progs: add support for loading the block group root Josef Bacik
2021-11-30 18:14   ` David Sterba
2021-11-05 20:40 ` [PATCH 05/22] btrfs-progs: add print support for the block group tree Josef Bacik
2021-11-05 20:40 ` Josef Bacik [this message]
2021-11-05 20:40 ` [PATCH 07/22] btrfs-progs: check-lowmem: use the btrfs_block_group_root helper Josef Bacik
2021-11-05 20:40 ` [PATCH 08/22] btrfs-progs: handle no bg item in extent tree for free space tree Josef Bacik
2021-11-05 20:40 ` [PATCH 09/22] btrfs-progs: mkfs: add support for the block group tree Josef Bacik
2021-11-05 20:40 ` [PATCH 10/22] btrfs-progs: check: add block group tree support Josef Bacik
2021-11-05 20:40 ` [PATCH 11/22] btrfs-progs: qgroup-verify: scan extents based on block groups Josef Bacik
2021-11-05 20:40 ` [PATCH 12/22] btrfs-progs: check: make free space tree validation extent tree v2 aware Josef Bacik
2021-11-05 20:40 ` [PATCH 13/22] btrfs-progs: check: add helper to reinit the root based on a key Josef Bacik
2021-11-05 20:40 ` [PATCH 14/22] btrfs-progs: check: handle the block group tree properly Josef Bacik
2021-11-05 20:40 ` [PATCH 15/22] btrfs-progs: load the number of global roots into the fs_info Josef Bacik
2021-11-05 20:40 ` [PATCH 16/22] btrfs-progs: handle the per-block group global root id Josef Bacik
2021-11-05 20:40 ` [PATCH 17/22] btrfs-progs: add a btrfs_delete_and_free_root helper Josef Bacik
2021-11-05 20:40 ` [PATCH 18/22] btrfs-progs: make btrfs_clear_free_space_tree extent tree v2 aware Josef Bacik
2021-11-05 20:40 ` [PATCH 19/22] btrfs-progs: make btrfs_create_tree take a key for the root key Josef Bacik
2021-11-05 20:40 ` [PATCH 20/22] btrfs-progs: mkfs: set chunk_item_objectid properly for extent tree v2 Josef Bacik
2021-11-05 20:40 ` [PATCH 21/22] btrfs-progs: mkfs: create the global root's Josef Bacik
2021-11-05 20:40 ` [PATCH 22/22] btrfs-progs: check: don't do the root item check for extent tree v2 Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=742e40465dc7ab1c055900a0468a059c77be5087.1636144275.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.