btrfs-progs/check
Qu Wenruo 04930385fd btrfs-progs: check: enhance the error output for backref mismatch
[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>
2023-01-25 16:19:59 +01:00
..
clear-cache.c btrfs-progs: use template for transaction start error messages 2022-10-11 09:08:10 +02:00
clear-cache.h btrfs-progs: check: factor out code for clearing caches 2022-10-11 09:08:09 +02:00
common.h btrfs-progs: check: move global variables to common headers 2022-10-11 09:08:09 +02:00
main.c btrfs-progs: check: enhance the error output for backref mismatch 2023-01-25 16:19:59 +01:00
mode-common.c btrfs-progs: sync compression.h from the kernel 2022-11-30 19:14:29 +01:00
mode-common.h btrfs-progs: check: move global variables to common headers 2022-10-11 09:08:09 +02:00
mode-lowmem.c btrfs-progs: sync compression.h from the kernel 2022-11-30 19:14:29 +01:00
mode-lowmem.h btrfs-progs: check: update include lists 2022-10-11 09:06:12 +02:00
mode-original.h
qgroup-verify.c Revert "btrfs-progs: rename qgroup items to match the kernel naming scheme" 2023-01-03 13:10:54 +01:00
qgroup-verify.h btrfs-progs: check: update include lists 2022-10-11 09:06:12 +02:00
repair.c btrfs-progs: check: rename global repair option 2022-10-11 09:08:09 +02:00
repair.h btrfs-progs: check: rename global repair option 2022-10-11 09:08:09 +02:00