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 v2 28/30] btrfs-progs: mkfs: set chunk_item_objectid properly for extent tree v2
Date: Wed, 10 Nov 2021 15:14:40 -0500	[thread overview]
Message-ID: <5615450f3dc9e4847a51205eb57b3fbf9821c036.1636575147.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1636575146.git.josef@toxicpanda.com>

Our initial block group will use global root id 0 with extent tree v2,
so adjust the helper to take the chunk_objectid as an argument, as we'll
set this to 0 for extent tree v2 and then
BTRFS_FIRST_CHUNK_TREE_OBJECTID for extent tree v1.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 mkfs/common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mkfs/common.c b/mkfs/common.c
index 71589c0d..479b1150 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -192,7 +192,7 @@ static int create_free_space_tree(int fd, struct btrfs_mkfs_config *cfg,
 
 static void write_block_group_item(struct extent_buffer *buf, u32 nr,
 				   u64 objectid, u64 offset, u64 used,
-				   u32 itemoff)
+				   u64 chunk_objectid, u32 itemoff)
 {
 	struct btrfs_block_group_item *bg_item;
 	struct btrfs_disk_key disk_key;
@@ -207,8 +207,7 @@ static void write_block_group_item(struct extent_buffer *buf, u32 nr,
 	bg_item = btrfs_item_ptr(buf, nr, struct btrfs_block_group_item);
 	btrfs_set_block_group_used(buf, bg_item, used);
 	btrfs_set_block_group_flags(buf, bg_item, BTRFS_BLOCK_GROUP_SYSTEM);
-	btrfs_set_block_group_chunk_objectid(buf, bg_item,
-					     BTRFS_FIRST_CHUNK_TREE_OBJECTID);
+	btrfs_set_block_group_chunk_objectid(buf, bg_item, chunk_objectid);
 }
 
 static int create_block_group_tree(int fd, struct btrfs_mkfs_config *cfg,
@@ -219,7 +218,7 @@ static int create_block_group_tree(int fd, struct btrfs_mkfs_config *cfg,
 
 	memset(buf->data + sizeof(struct btrfs_header), 0,
 		cfg->nodesize - sizeof(struct btrfs_header));
-	write_block_group_item(buf, 0, bg_offset, bg_size, bg_used,
+	write_block_group_item(buf, 0, bg_offset, bg_size, bg_used, 0,
 			       __BTRFS_LEAF_DATA_SIZE(cfg->nodesize) -
 			       sizeof(struct btrfs_block_group_item));
 	btrfs_set_header_bytenr(buf, cfg->blocks[MKFS_BLOCK_GROUP_TREE]);
@@ -404,6 +403,7 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
 			write_block_group_item(buf, nritems,
 					       system_group_offset,
 					       system_group_size, total_used,
+					       BTRFS_FIRST_CHUNK_TREE_OBJECTID,
 					       itemoff);
 			add_block_group = false;
 			nritems++;
-- 
2.26.3


  parent reply	other threads:[~2021-11-10 20:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 20:14 [PATCH v2 00/30] btrfs-progs: extent tree v2 support, global roots Josef Bacik
2021-11-10 20:14 ` [PATCH v2 01/30] btrfs-progs: stop accessing ->extent_root directly Josef Bacik
2021-11-10 20:14 ` [PATCH v2 02/30] btrfs-progs: stop accessing ->free_space_root directly Josef Bacik
2021-11-10 20:14 ` [PATCH v2 03/30] btrfs-progs: track csum, extent, and free space trees in a rb tree Josef Bacik
2021-11-10 20:14 ` [PATCH v2 04/30] btrfs-progs: check: make reinit work per found root item Josef Bacik
2021-11-10 20:14 ` [PATCH v2 05/30] btrfs-progs: check: check the global roots for uptodate root nodes Josef Bacik
2021-11-10 20:14 ` [PATCH v2 06/30] btrfs-progs: check: check all of the csum roots Josef Bacik
2021-11-10 20:14 ` [PATCH v2 07/30] btrfs-progs: check: fill csum root from all extent roots Josef Bacik
2021-11-10 20:14 ` [PATCH v2 08/30] btrfs-progs: common: search all extent roots for marking used space Josef Bacik
2021-11-10 20:14 ` [PATCH v2 09/30] btrfs-progs: common: allow users to select extent-tree-v2 option Josef Bacik
2021-11-10 20:14 ` [PATCH v2 10/30] btrfs-progs: add definitions for the block group tree Josef Bacik
2021-11-10 20:14 ` [PATCH v2 11/30] btrfs-progs: add on disk pointers to global tree ids Josef Bacik
2021-11-10 20:14 ` [PATCH v2 12/30] btrfs-progs: add support for loading the block group root Josef Bacik
2021-11-10 20:14 ` [PATCH v2 13/30] btrfs-progs: add print support for the block group tree Josef Bacik
2021-11-10 20:14 ` [PATCH v2 14/30] btrfs-progs: mkfs: use the btrfs_block_group_root helper Josef Bacik
2021-11-10 20:14 ` [PATCH v2 15/30] btrfs-progs: check-lowmem: " Josef Bacik
2021-11-10 20:14 ` [PATCH v2 16/30] btrfs-progs: handle no bg item in extent tree for free space tree Josef Bacik
2021-11-10 20:14 ` [PATCH v2 17/30] btrfs-progs: mkfs: add support for the block group tree Josef Bacik
2021-11-10 20:14 ` [PATCH v2 18/30] btrfs-progs: check: add block group tree support Josef Bacik
2021-11-10 20:14 ` [PATCH v2 19/30] btrfs-progs: qgroup-verify: scan extents based on block groups Josef Bacik
2021-11-10 20:14 ` [PATCH v2 20/30] btrfs-progs: check: make free space tree validation extent tree v2 aware Josef Bacik
2021-11-10 20:14 ` [PATCH v2 21/30] btrfs-progs: check: add helper to reinit the root based on a key Josef Bacik
2021-11-10 20:14 ` [PATCH v2 22/30] btrfs-progs: check: handle the block group tree properly Josef Bacik
2021-11-10 20:14 ` [PATCH v2 23/30] btrfs-progs: load the number of global roots into the fs_info Josef Bacik
2021-11-10 20:14 ` [PATCH v2 24/30] btrfs-progs: handle the per-block group global root id Josef Bacik
2021-11-10 20:14 ` [PATCH v2 25/30] btrfs-progs: add a btrfs_delete_and_free_root helper Josef Bacik
2021-11-10 20:14 ` [PATCH v2 26/30] btrfs-progs: make btrfs_clear_free_space_tree extent tree v2 aware Josef Bacik
2021-11-10 20:14 ` [PATCH v2 27/30] btrfs-progs: make btrfs_create_tree take a key for the root key Josef Bacik
2021-11-10 20:14 ` Josef Bacik [this message]
2021-11-10 20:14 ` [PATCH v2 29/30] btrfs-progs: mkfs: create the global root's Josef Bacik
2021-11-15 20:51   ` David Sterba
2021-11-16 14:45     ` [PATCH v3] " Josef Bacik
2021-11-10 20:14 ` [PATCH v2 30/30] 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=5615450f3dc9e4847a51205eb57b3fbf9821c036.1636575147.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.