bmap: scripts: Fixed missing geometry race condition

The gbmap's weight is defined by the block count stored in the geometry
config field, which should always be present in valid littlefs3 images.

But our scripts routinely try to parse _invalid_ littlefs3 images when
running in parallel with benchmarks/tests (littlefs3 does _not_ support
multiple read/writers), so this was causing exceptions to be thrown.

The fix is to just assume weight=0 when the geometry field is missing.
The image isn't valid, and the gbmap is optional anyways.
This commit is contained in:
Christopher Haster
2025-07-28 01:26:33 -05:00
parent 71b9ad2412
commit 8666830515
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -2778,7 +2778,8 @@ class Gstate:
block, trunk, cksum, d_ = frombranch(self.data, d); d += d_
self.btree = Btree.fetchck(
mtree.bd, block, trunk,
config.geometry.block_count,
config.geometry.block_count
if config.geometry is not None else 0,
cksum)
def repr(self):
+2 -1
View File
@@ -2808,7 +2808,8 @@ class Gstate:
block, trunk, cksum, d_ = frombranch(self.data, d); d += d_
self.btree = Btree.fetchck(
mtree.bd, block, trunk,
config.geometry.block_count,
config.geometry.block_count
if config.geometry is not None else 0,
cksum)
def repr(self):
+2 -1
View File
@@ -2735,7 +2735,8 @@ class Gstate:
block, trunk, cksum, d_ = frombranch(self.data, d); d += d_
self.btree = Btree.fetchck(
mtree.bd, block, trunk,
config.geometry.block_count,
config.geometry.block_count
if config.geometry is not None else 0,
cksum)
def repr(self):