From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 6/6] btrfs-progs: check: Introduce support for bg-tree feature
Date: Fri, 28 Dec 2018 16:38:06 +0800 [thread overview]
Message-ID: <20181228083806.3204-7-wqu@suse.com> (raw)
In-Reply-To: <20181228083806.3204-1-wqu@suse.com>
For original mode BLOCK_GROUP_ITEM can occur in bg tree.
For lowmem mode just check BLOCK_GROUP_ITEM in bg tree if the that
feature is set.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
check/main.c | 3 ++-
check/mode-lowmem.c | 9 +++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/check/main.c b/check/main.c
index 54ab146d0d13..255f762db3c3 100644
--- a/check/main.c
+++ b/check/main.c
@@ -6013,7 +6013,8 @@ static int check_type_with_root(u64 rootid, u8 key_type)
case BTRFS_EXTENT_ITEM_KEY:
case BTRFS_METADATA_ITEM_KEY:
case BTRFS_BLOCK_GROUP_ITEM_KEY:
- if (rootid != BTRFS_EXTENT_TREE_OBJECTID)
+ if (rootid != BTRFS_EXTENT_TREE_OBJECTID &&
+ rootid != BTRFS_BLOCK_GROUP_TREE_OBJECTID)
goto err;
break;
case BTRFS_ROOT_ITEM_KEY:
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 7bb079a98ea9..acfffe1fef87 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -4229,7 +4229,7 @@ next:
static int check_chunk_item(struct btrfs_fs_info *fs_info,
struct extent_buffer *eb, int slot)
{
- struct btrfs_root *extent_root = fs_info->extent_root;
+ struct btrfs_root *root;
struct btrfs_root *dev_root = fs_info->dev_root;
struct btrfs_path path;
struct btrfs_key chunk_key;
@@ -4251,6 +4251,11 @@ static int check_chunk_item(struct btrfs_fs_info *fs_info,
int ret;
int err = 0;
+ if (btrfs_fs_incompat(fs_info, BG_TREE))
+ root = fs_info->bg_root;
+ else
+ root = fs_info->extent_root;
+
btrfs_item_key_to_cpu(eb, &chunk_key, slot);
chunk = btrfs_item_ptr(eb, slot, struct btrfs_chunk);
length = btrfs_chunk_length(eb, chunk);
@@ -4270,7 +4275,7 @@ static int check_chunk_item(struct btrfs_fs_info *fs_info,
bg_key.offset = length;
btrfs_init_path(&path);
- ret = btrfs_search_slot(NULL, extent_root, &bg_key, &path, 0, 0);
+ ret = btrfs_search_slot(NULL, root, &bg_key, &path, 0, 0);
if (ret) {
error(
"chunk[%llu %llu) did not find the related block group item",
--
2.20.1
next prev parent reply other threads:[~2018-12-28 8:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-28 8:38 [PATCH 0/6] btrfs-progs: Support for BG_TREE feature Qu Wenruo
2018-12-28 8:38 ` [PATCH 1/6] btrfs-progs: Refactor excluded extent functions to use fs_info Qu Wenruo
2018-12-28 8:38 ` [PATCH 2/6] btrfs-progs: Refactor btrfs_read_block_groups() Qu Wenruo
2018-12-28 8:38 ` [PATCH 3/6] btrfs-progs: Enable read-write ability for 'bg_tree' feature Qu Wenruo
2018-12-28 8:38 ` [PATCH 4/6] btrfs-progs: mkfs: Introduce -O bg-tree Qu Wenruo
2018-12-28 8:38 ` [PATCH 5/6] btrfs-progs: dump-tree/dump-super: Introduce support for bg tree Qu Wenruo
2018-12-28 8:38 ` Qu Wenruo [this message]
2019-02-25 16:36 ` [PATCH 0/6] btrfs-progs: Support for BG_TREE feature Hans van Kranenburg
2019-02-26 1:29 ` Qu Wenruo
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=20181228083806.3204-7-wqu@suse.com \
--to=wqu@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).