t: Implemented gc_compact_thresh over bshrub nodes

These aren't really different than btree nodes, except bshrubs need to
be enrolled in our opened list for commits to work.

Fortunately this is already true for explicit traversals, which are
currently the only traversals where we need to simultaneously mutate the
filesystem. This mainly just required adding additional checks for
LFS_TYPE_TRAVERSAL bshrubs, tests, and making sure traversal.bshrub is
never in an invalid state.

This continues to add code/stack cost for what is ultimately a
relatively niche feature:

           code          stack
  before: 35268           2776
  after:  35448 (+0.5%)   2800 (+0.9%)

Maybe btree/bshrub compactions should be disabled by default?
This commit is contained in:
Christopher Haster
2024-07-01 13:22:35 -05:00
parent 227b804c7a
commit f3446abfa7
3 changed files with 525 additions and 30 deletions
+5 -3
View File
@@ -613,13 +613,15 @@ typedef struct lfsr_btraversal {
} lfsr_btraversal_t;
typedef struct lfsr_mtraversal {
// core state machine
uint8_t state;
uint16_t flags;
// opened file state
lfsr_omdir_t *o;
// bshrub/btree state
// this lines up with bshrub/btree in lfsr_file_t
lfsr_bshrub_t bshrub;
lfsr_bshrub_t bshrub_;
// core state machine
uint8_t state;
uint16_t flags;
union {
// cycle detection state, only valid when traversing the mroot chain
struct {