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

View File

@ -57,7 +57,8 @@ FLAGS = [
# Filesystem format flags
('F', 'MODE', 1, "Format's access mode" ),
('^', 'RDWR', 0, "Format the filesystem as read and write" ),
('F', 'NOISY', 0x00000010, "Add noise to revision counts" ),
('F', 'REVDBG', 0x00000010, "Add debug info to revision counts" ),
('F', 'REVNOISE', 0x00000020, "Add noise to revision counts" ),
('F', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
('F', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
('F', 'CKPARITY', 0x00002000, "Check metadata tag parity bits" ),
@ -73,7 +74,8 @@ FLAGS = [
('^', 'RDONLY', 1, "Mount the filesystem as read only" ),
('M', 'FLUSH', 0x00000040, "Open all files with LFS_O_FLUSH" ),
('M', 'SYNC', 0x00000080, "Open all files with LFS_O_SYNC" ),
('M', 'NOISY', 0x00000010, "Add noise to revision counts" ),
('M', 'REVDBG', 0x00000010, "Add debug info to revision counts" ),
('M', 'REVNOISE', 0x00000020, "Add noise to revision counts" ),
('M', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
('M', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
('M', 'CKPARITY', 0x00002000, "Check metadata tag parity bits" ),
@ -99,7 +101,8 @@ FLAGS = [
('I', 'RDONLY', 0x00000001, "Mounted read only" ),
('I', 'FLUSH', 0x00000040, "Mounted with LFS_M_FLUSH" ),
('I', 'SYNC', 0x00000080, "Mounted with LFS_M_SYNC" ),
('I', 'NOISY', 0x00000010, "Mounted with LFS_M_NOISY" ),
('I', 'REVDBG', 0x00000010, "Mounted with LFS_M_REVDBG" ),
('I', 'REVNOISE', 0x00000020, "Mounted with LFS_M_REVNOISE" ),
('I', 'CKPROGS', 0x00000800, "Mounted with LFS_M_CKPROGS" ),
('I', 'CKFETCHES', 0x00001000, "Mounted with LFS_M_CKFETCHES" ),
('I', 'CKPARITY', 0x00002000, "Mounted with LFS_M_CKPARITY" ),
@ -113,6 +116,8 @@ FLAGS = [
('I', 'CKMETA', 0x00100000, "Metadata checksums not checked recently" ),
('I', 'CKDATA', 0x00200000, "Data checksums not checked recently" ),
('i', 'INMTREE', 0x01000000, "Committing to mtree" ),
# Traversal flags
('T', 'MTREEONLY', 0x00000010, "Only traverse the mtree" ),
('T', 'MKCONSISTENT',