This will make dump-tree less dumb when it gets some item offset/size
bit flip.

The output example can be found in the first patch, and the 2nd patch is
the test case to ensure it works as expected.

The design goal is to make debugging a little easier, I don't think
bit flip handler should be fixed in btrfs-progs directly, as the
complexity isn't worthy.
We should ensure it's not btrfs or some other strange kernel module
modifying eb memory in the first place.

So only dump-tree supports item size/offset bit flip detection, just to
make debugging a little easier.

Qu Wenruo (2):
  btrfs-progs: dump-tree: Do simple bit flip check and continue if we
    can handle it
  btrfs-progs: misc-tests: Test if dump-tree can handle obviously
    flipped bit in btrfs item

 print-tree.c                                  | 100 ++++++++++++++----
 .../misc-tests/036-dump-tree-bit-flip/test.sh |  21 ++++
 .../two_corrupted_items.raw.xz                | Bin 0 -> 22024 bytes
 3 files changed, 102 insertions(+), 19 deletions(-)
 create mode 100755 tests/misc-tests/036-dump-tree-bit-flip/test.sh
 create mode 100644 
tests/misc-tests/036-dump-tree-bit-flip/two_corrupted_items.raw.xz

-- 
2.21.0

Reply via email to