[PROBLEM]
Btrfs check original mode output is not that reader friendly already, it
even includes pointer output:
backref 15353727729664 parent 1140559929556992 not referenced back 0xc9133d70
tree backref 15353727729664 parent 14660022714368 not found in extent tree
incorrect global backref count on 15353727729664 found 3 wanted 2
backpointer mismatch on [15353727729664 16384]
In above case, the "0xc9133d70" is completely useless, as it's a pointer
for the tree_backref structure.
And the term "backref" is quite abused in above case.
[ENHANCEMENT]
To enhance the situation, let's use some output format from lowmem mode
instead.
Now above example will be changed to:
tree extent[15353727729664, 16384] parent 1140559929556992 has no tree block found
tree extent[15353727729664, 16384] parent 14660022714368 has no backref item in extent tree
incorrect global backref count on 15353727729664 found 3 wanted 2
backpointer mismatch on [15353727729664 16384]
And some example for data backrefs:
data extent[12845056, 1048576] bytenr mimsmatch, extent item bytenr 12845056 file item bytenr 0
data extent[12845056, 1048576] referencer count mismatch (root 5 owner 257 offset 0) wanted 1 have 0
data extent[14233600, 12288] referencer count mismatch (parent 42139648) wanted 0 have 1
data extent[14233600, 12288] referencer count mismatch (root 5 owner 307 offset 0) wanted 0 have 1
data extent[14233600, 12288] referencer count mismatch (parent 30507008) wanted 0 have 1
Furthermore, the original function print_tree_backref_error() is a mess
already, here we clean it up by exacting all the error output into a
dedicated helper, print_backref_error(), so the function itself only
need to find out errors.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>