Thread (16 messages) 16 messages, 1 author, 2021-12-15
STALE1672d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 06/15] btrfs-progs: check: update block group used properly for extent tree v2

From: Josef Bacik <josef@toxicpanda.com>
Date: 2021-12-15 20:15:06
Subsystem: the rest · Maintainer: Linus Torvalds

For extent tree v2 we do not have metadata tracked in the extent root,
so every block we find we must account for as used in the appropriate
block group.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/check/main.c b/check/main.c
index da5aab89..cee7e7a0 100644
--- a/check/main.c
+++ b/check/main.c
@@ -6412,6 +6412,14 @@ static int run_next_block(struct btrfs_root *root,
 	if (ret)
 		goto out;
 
+	/*
+	 * Extent tree v2 doesn't track metadata in the extent tree, mark any
+	 * blocks we find as used for the block group.
+	 */
+	if (btrfs_fs_incompat(gfs_info, EXTENT_TREE_V2))
+		update_block_group_used(block_group_cache, buf->start,
+					gfs_info->nodesize);
+
 	if (btrfs_is_leaf(buf)) {
 		btree_space_waste += btrfs_leaf_free_space(buf);
 		for (i = 0; i < nritems; i++) {
-- 
2.26.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help