Added LFS_REVDBG, tweaked LFS_REVNOISE

This tweaks a number of extended revision count things:

- Added LFS_REVDBG, which adds debug info to revision counts.

  This initializes the bottom 12 bits of every revision count with a
  hint based on rbyd type, which may be useful when debugging:

  - 68 69 21 v0 (hi!.) => mroot anchor
  - 6d 72 7e v0 (mr~.) => mroot
  - 6d 64 7e v0 (md~.) => mdir
  - 62 74 7e v0 (bt~.) => file btree node
  - 62 6d 7e v0 (bm~.) => mtree node

  This may be overwritten by the recycle counter if it overlaps, worst
  case the recycle counter takes up the entire revision count, but these
  have been chosen to at least keep some info if partially overwritten.

  To make this work required the LFS_i_INMTREE hack (yay global state),
  but a hack for debug info isn't the end of the world.

  Note we don't have control over data blocks, so there's always a
  chance they end up containing what looks like one of the above
  revision counts.

- Renamed LFS_NOISY -> LFS_REVNOISE

- LFS_REVDBG and LFS_REVNOISE are incompatible, so using both asserts.

  This also frees up the theoretical 0x00000030 state for an additional
  rev mode in the future.

- Adopted LFS_REVNOISE (and LFS_REVDBG) in btree nodes as well.

  If you need rev noise, you probably want it in all rbyds/metadata
  blocks, not just mdirs.

---

This had no effect on the default code size, but did affect
LFS_REVNOISE:

                    code          stack          ctx
  before:          35688           2440          640
  after:           35688 (+0.0%)   2440 (+0.0%)  640 (+0.0%)

  revnoise before: 35744           2440          640
  revnoise after:  35880 (+0.4%)   2440 (+0.0%)  640 (+0.0%)

  default:         35688           2440          640
  revdbg:          35912 (+0.6%)   2448 (+0.3%)  640 (+0.0%)
  revnoise:        35880 (+0.5%)   2440 (+0.0%)  640 (+0.0%)
This commit is contained in:
Christopher Haster
2025-04-21 13:45:36 -05:00
parent 7cd4c1f12f
commit 96eb38c8c2
6 changed files with 262 additions and 47 deletions
+14 -5
View File
@@ -5,15 +5,24 @@ after = ['test_rbyd', 'test_btree']
# of the disk for these tests
defines.LOOKAHEAD_SIZE = 'BLOCK_COUNT / 8'
# test with and without revision count noise
defines.NOISY = [false, true]
# test with normal revision counts, debug revision counts, and noisy
# revision counts
defines.REVDBG = [false, true]
defines.REVNOISE = [false, true]
defines.F_FLAGS = '''
((NOISY) ? LFS_IFDEF_NOISY(LFS_F_NOISY, -1) : 0)
((REVDBG) ? LFS_IFDEF_REVDBG(LFS_F_REVDBG, -1) : 0)
| ((REVNOISE) ? LFS_IFDEF_REVNOISE(LFS_F_REVNOISE, -1) : 0)
'''
defines.M_FLAGS = '''
((NOISY) ? LFS_IFDEF_NOISY(LFS_M_NOISY, -1) : 0)
((REVDBG) ? LFS_IFDEF_REVDBG(LFS_M_REVDBG, -1) : 0)
| ((REVNOISE) ? LFS_IFDEF_REVNOISE(LFS_M_REVNOISE, -1) : 0)
'''
if = 'LFS_IFDEF_NOISY(true, !NOISY)'
if = [
'LFS_IFDEF_REVDBG(true, !REVDBG)',
'LFS_IFDEF_REVNOISE(true, !REVNOISE)',
'!REVDBG || !REVNOISE',
]
# test a single mroot