diff mbox series

[v2,09/15] btrfs-progs: repair: traverse tree blocks for extent tree v2

Message ID d390f5aa73e9f2a95d02dce73798d6eeab54aaa0.1646691128.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: extent tree v2 gc tree and metadata ref changes | expand

Commit Message

Josef Bacik March 7, 2022, 10:13 p.m. UTC
If we have extent-tree-v2 enabled we can't only rely on the extent trees
to find all the used space, we have to walk all the trees as well.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 common/repair.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/common/repair.c b/common/repair.c
index 37a6943f..db462955 100644
--- a/common/repair.c
+++ b/common/repair.c
@@ -219,6 +219,12 @@  int btrfs_mark_used_blocks(struct btrfs_fs_info *fs_info,
 	struct rb_node *n;
 	int ret;
 
+	if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) {
+		ret = btrfs_mark_used_tree_blocks(fs_info, tree);
+		if (ret)
+			return ret;
+	}
+
 	root = btrfs_extent_root(fs_info, 0);
 	while (1) {
 		ret = populate_used_from_extent_root(root, tree);