t: Changed mtinfo/btinfo to refer to mdirs/rbyds by pointer

This solves the issue of multiple mdirs/rbyds in lfsr_mtree_gc, where
it's easy for traversal state to fall out of sync when mutating parts of
the filesystem.

Is it good design, with self-referential pointers making everything more
entangled? Not sure!

This saves a bit of stack, but adds a bit of code, which makes sense,
pointer chasing can be costly. But both of these changes are well below
the compiler noise floor:

           code          stack
  before: 35228           2688
  after:  35256 (+0.1%)   2680 (-0.3%)
This commit is contained in:
Christopher Haster
2024-07-04 02:10:40 -05:00
parent bfc108c1dc
commit 3c7b462659
5 changed files with 152 additions and 155 deletions
+6 -6
View File
@@ -4109,11 +4109,11 @@ code = '''
printf("traversal: %d 0x%x btree 0x%x.%x\n",
bid,
btinfo.tag,
btinfo.u.rbyd.blocks[0], btinfo.u.rbyd.trunk);
btinfo.u.rbyd->blocks[0], btinfo.u.rbyd->trunk);
// keep track of seen blocks
seen[btinfo.u.rbyd.blocks[0] / 8]
|= 1 << (btinfo.u.rbyd.blocks[0] % 8);
seen[btinfo.u.rbyd->blocks[0] / 8]
|= 1 << (btinfo.u.rbyd->blocks[0] % 8);
} else if (btinfo.tag == LFSR_TAG_DATA) {
printf("traversal: %d 0x%x data %d\n",
@@ -4258,11 +4258,11 @@ code = '''
printf("traversal: %d 0x%x btree 0x%x.%x\n",
bid,
btinfo.tag,
btinfo.u.rbyd.blocks[0], btinfo.u.rbyd.trunk);
btinfo.u.rbyd->blocks[0], btinfo.u.rbyd->trunk);
// keep track of seen blocks
seen[btinfo.u.rbyd.blocks[0] / 8]
|= 1 << (btinfo.u.rbyd.blocks[0] % 8);
seen[btinfo.u.rbyd->blocks[0] / 8]
|= 1 << (btinfo.u.rbyd->blocks[0] % 8);
} else if (btinfo.tag == LFSR_TAG_DATA) {
printf("traversal: %d 0x%x data %d\n",