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

[PATCH 05/15] btrfs-progs: check: make metadata ref counting extent tree v2 aware

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

We do not want to bother validating extent tree references with tree
block references, so only set the references if extent tree v2 isn't set
so that we do not spit out extent tree errors for extent tree v2.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/main.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/check/main.c b/check/main.c
index 1b3ea079..da5aab89 100644
--- a/check/main.c
+++ b/check/main.c
@@ -6622,7 +6622,14 @@ static int run_next_block(struct btrfs_root *root,
 				btrfs_node_ptr_generation(buf, i);
 			tmpl.start = ptr;
 			tmpl.nr = size;
-			tmpl.refs = 1;
+
+			/*
+			 * We do not track refs for metadata in the extent tree,
+			 * do not mark it with a ref count.
+			 */
+			if (!btrfs_fs_incompat(gfs_info, EXTENT_TREE_V2))
+				tmpl.refs = 1;
+
 			tmpl.metadata = 1;
 			tmpl.max_size = size;
 			ret = add_extent_rec(extent_cache, &tmpl);
@@ -6675,7 +6682,14 @@ static int add_root_to_pending(struct extent_buffer *buf,
 	tmpl.start = buf->start;
 	tmpl.nr = buf->len;
 	tmpl.is_root = 1;
-	tmpl.refs = 1;
+
+	/*
+	 * Extent tree v2 does not track references for metadata, do not set
+	 * refs if it is set.
+	 */
+	if (!btrfs_fs_incompat(gfs_info, EXTENT_TREE_V2))
+		tmpl.refs = 1;
+
 	tmpl.metadata = 1;
 	tmpl.max_size = buf->len;
 	add_extent_rec(extent_cache, &tmpl);
-- 
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