diff mbox series

btrfs-progs: only spit out the parent or ref root for ref mismatches

Message ID 26927d5268dc42db5ba131dd80b190d474bd596f.1605800521.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: only spit out the parent or ref root for ref mismatches | expand

Commit Message

Josef Bacik Nov. 19, 2020, 3:42 p.m. UTC
While debugging some corruption, I got confused because it appeared as
if we had an invalid parent set on a extent reference, because of this
message

tree backref 67014213632 parent 5 root 5 not found in extent tree

But it turns out that parent and the root are a union, and we were just
printing it out regardless of the type of backref it was.  Fix the error
message to be consistent with the other mismatch messages, simply print
parent or root, depending on the ref type.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

David Sterba Dec. 11, 2020, 4:32 p.m. UTC | #1
On Thu, Nov 19, 2020 at 10:42:12AM -0500, Josef Bacik wrote:
> While debugging some corruption, I got confused because it appeared as
> if we had an invalid parent set on a extent reference, because of this
> message
> 
> tree backref 67014213632 parent 5 root 5 not found in extent tree
> 
> But it turns out that parent and the root are a union, and we were just
> printing it out regardless of the type of backref it was.  Fix the error
> message to be consistent with the other mismatch messages, simply print
> parent or root, depending on the ref type.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Added to devel, thanks.
diff mbox series

Patch

diff --git a/check/main.c b/check/main.c
index 69a47b31..345f86b1 100644
--- a/check/main.c
+++ b/check/main.c
@@ -3936,9 +3936,12 @@  static int all_backpointers_checked(struct extent_record *rec, int print_errs)
 			} else {
 				tback = to_tree_backref(back);
 				fprintf(stderr,
-"tree backref %llu parent %llu root %llu not found in extent tree\n",
+"tree backref %llu %s %llu not found in extent tree\n",
 					(unsigned long long)rec->start,
-					(unsigned long long)tback->parent,
+					back->full_backref ?
+					"parent" : "root",
+					back->full_backref ?
+					(unsigned long long)tback->parent :
 					(unsigned long long)tback->root);
 			}
 		}