From 6d97398efcc32e674e6216027cff0bbac79f3442 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sat, 19 Apr 2025 11:56:21 -0500 Subject: [PATCH] scripts: dbglfs.py: Fixed a couple mid=-1 issues - Fixed Mtree.lookupleaf accepting mbid=0, which caused dbglfs.py to double print all files with mbid=-1 - Fixed grm mids not being mapped to mbid=-1 and related orphan false positives --- scripts/dbgbmap.py | 8 ++++++-- scripts/dbgbmapd3.py | 8 ++++++-- scripts/dbglfs.py | 8 ++++++-- scripts/dbgmtree.py | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index dd2f1689..8a963405 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -1795,7 +1795,7 @@ class Mtree: # no mtree? must be inlined in mroot if self.mtree is None: - if mid.mbid >= (1 << self.mbits): + if mid.mbid != -1: if path: return None, path_ else: @@ -2761,7 +2761,11 @@ class Gstate: if count <= 2: for _ in range(count): mid, d_ = fromleb128(self.data, d); d += d_ - rms.append(mtree.mid(mid)) + mid = mtree.mid(mid) + # map mbids -> -1 if mroot-inlined + if mtree.mtree is None: + mid = mtree.mid(-1, mid.mrid) + rms.append(mid) self.count = count self.rms = rms diff --git a/scripts/dbgbmapd3.py b/scripts/dbgbmapd3.py index a5d47115..3223e0a5 100755 --- a/scripts/dbgbmapd3.py +++ b/scripts/dbgbmapd3.py @@ -1825,7 +1825,7 @@ class Mtree: # no mtree? must be inlined in mroot if self.mtree is None: - if mid.mbid >= (1 << self.mbits): + if mid.mbid != -1: if path: return None, path_ else: @@ -2791,7 +2791,11 @@ class Gstate: if count <= 2: for _ in range(count): mid, d_ = fromleb128(self.data, d); d += d_ - rms.append(mtree.mid(mid)) + mid = mtree.mid(mid) + # map mbids -> -1 if mroot-inlined + if mtree.mtree is None: + mid = mtree.mid(-1, mid.mrid) + rms.append(mid) self.count = count self.rms = rms diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index 211e12d4..08589f5e 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -1752,7 +1752,7 @@ class Mtree: # no mtree? must be inlined in mroot if self.mtree is None: - if mid.mbid >= (1 << self.mbits): + if mid.mbid != -1: if path: return None, path_ else: @@ -2718,7 +2718,11 @@ class Gstate: if count <= 2: for _ in range(count): mid, d_ = fromleb128(self.data, d); d += d_ - rms.append(mtree.mid(mid)) + mid = mtree.mid(mid) + # map mbids -> -1 if mroot-inlined + if mtree.mtree is None: + mid = mtree.mid(-1, mid.mrid) + rms.append(mid) self.count = count self.rms = rms diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index 192da568..b344d137 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -1718,7 +1718,7 @@ class Mtree: # no mtree? must be inlined in mroot if self.mtree is None: - if mid.mbid >= (1 << self.mbits): + if mid.mbid != -1: if path: return None, path_ else: