Fixed dbgbmap.py missing btree nodes

The internal btree node traversal here is a bit different than in
dbgbtree.py, dbgmtree.py, etc, because we want to include both inner and
leaf nodes. We could decode the branch tags multiple times, but checking
for bid changes is a bit simpler.

It's interesting to note this went missed for so long, because, well,
it's hard to actually have more than one btree node. And the tests
explicitly covering large btree structures, test_btree, aren't parsable
by dbgbmap.py since they don't create real filesystem images.
This commit is contained in:
Christopher Haster
2024-07-01 13:11:45 -05:00
parent 61ecc135dc
commit 227b804c7a

View File

@@ -1169,7 +1169,10 @@ def main(disk, mroots=None, *,
enumerate(ppath)):
if x is None:
break
if not (changed or px is None or x[0] != px[0]):
if not (changed
or px is None
# bid-rid changed?
or (x[1][0]-x[1][3]) != (px[1][0]-px[1][3])):
continue
changed = True
@@ -1272,12 +1275,15 @@ def main(disk, mroots=None, *,
enumerate(ppath)):
if x is None:
break
if not (changed or px is None or x[0] != px[0]):
if not (changed
or px is None
# bid-rid changed?
or (x[1][0]-x[1][3]) != (px[1][0]-px[1][3])):
continue
changed = True
# mark btree inner nodes in our bmap
d, (mid_, w_, rbyd_, rid_, tags_) = x
d, (bid_, w_, rbyd_, rid_, tags_) = x
# ignore bshrub roots
if shrub and d == 0:
continue