Tried to clean up one-line file state in dbglfs.py

Before:

  littlefs v2.0 0x{0,1}.232, rev 99, weight 9.256, bd 4096x256
  {00a3,00a4}:   0.1 file0000  reg 32768, trunk 0xa3.a8 32768, btree 0x1a.846 32704
                 0.2 file0001  reg 32768, trunk 0xa3.16c 32768, btree 0xa2.be1 32704

After:

  littlefs v2.0 0x{0,1}.232, rev 99, weight 9.256, bd 4096x256
  {00a3,00a4}:   0.1 file0000  reg 32768, trunk 0xa3.a8, btree 0x1a.846
                 0.2 file0001  reg 32768, trunk 0xa3.16c, btree 0xa2.be1

Most files will have both a shrub and a btree, which makes the previous
output problematically noisy.

Unfortunately, this does lose some information: the size of the
shrub/tree, both of which may be less than the full file. But 1. this
is _technically_ redundant since you only need the block/trunk to fetch an
rbyd (though the weight is useful), and 2. The weight can still be
viewed with -s -i.
This commit is contained in:
Christopher Haster
2023-10-30 15:44:22 -05:00
parent 4ecf4cc654
commit 06439f0cc4
+4 -4
View File
@@ -1272,25 +1272,25 @@ def frepr(mdir, rid, tag):
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, TAG_DATA)
if not done and rid_ == rid and tag_ == TAG_DATA:
size = max(size, len(data))
structs.append('data 0x%x.%x %d' % (mdir.block, j+d, len(data)))
structs.append('data 0x%x.%x' % (mdir.block, j+d))
# shrub?
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, TAG_TRUNK)
if not done and rid_ == rid and tag_ == TAG_TRUNK:
weight, trunk = fromshrub(data)
size = max(size, weight)
structs.append('trunk 0x%x.%x %d' % (mdir.block, trunk, weight))
structs.append('trunk 0x%x.%x' % (mdir.block, trunk))
# direct block?
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, TAG_BLOCK)
if not done and rid_ == rid and tag_ == TAG_BLOCK:
size_, block, off = frombptr(data)
size = max(size, size_)
structs.append('block 0x%x.%x %d' % (block, off, size_))
structs.append('block 0x%x.%x' % (block, off))
# indirect btree?
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, TAG_BTREE)
if not done and rid_ == rid and tag_ == TAG_BTREE:
weight, block, trunk, cksum = frombtree(data)
size = max(size, weight)
structs.append('btree 0x%x.%x %d' % (block, trunk, weight))
structs.append('btree 0x%x.%x' % (block, trunk))
return 'reg %s' % ', '.join(it.chain(['%d' % size], structs))
else: