btrfs: ref-verify: pass down tree block level when building refs
authorJosef Bacik <josef@toxicpanda.com>
Wed, 16 Dec 2020 16:18:46 +0000 (11:18 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:50 +0000 (22:58 +0100)
commit0d73a11c62642a25b688d09ae04b3b1f1b58ebb9
tree5aa56b156fbef97a6e0efab42bb4f1f0b74ff413
parent1fec12a560033ebe8fa6857dd3cbf9677371fbee
btrfs: ref-verify: pass down tree block level when building refs

I noticed that sometimes I would have the wrong level printed out with
ref-verify while testing some error injection related problems.  This is
because we only get the level from the main extent item, but our
references could go off the current leaf into another, and at that point
we lose our level.

Fix this by keeping track of the last tree block level that we found,
the same way we keep track of our bytenr and num_bytes, in case we
happen to wander into another leaf while still processing the references
for a bytenr.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ref-verify.c