btree: Dropped reliance on leaf cache during traversals
Brings back lfs3_btrv_t, but keeps some of the btree internal changes.
I think the biggest one is dropping the internal branch pointer, now
instead of internally pointing to the root rbyd, we just unconditionally
sync the rbyd state anytime the rbyd matches the root's weight. This is
necessary to avoid out-of-sync state when traversing bshrubs under
mutation.
Also after refactoring I think the current btree traversal logic is
easier to read.
---
This is in preparation for removing the leaf cache, or at least making
it opt-in.
It adds a chunk of stack, but in theory we can reclaim this by allowing
leaf caches to be disabled:
code stack ctx
before: 37160 2352 688
after: 37088 (-0.2%) 2384 (+1.4%) 688 (+0.0%)
This commit is contained in:
@@ -850,6 +850,12 @@ typedef struct lfs3_dir {
|
||||
} lfs3_dir_t;
|
||||
|
||||
// littlefs traversal type
|
||||
typedef struct lfs3_btrv {
|
||||
lfs3_sbid_t bid;
|
||||
lfs3_rbyd_t rbyd;
|
||||
lfs3_srid_t rid;
|
||||
} lfs3_btrv_t;
|
||||
|
||||
typedef struct lfs3_mtrv {
|
||||
// mdir/bshrub/btree state, this also includes our traversal
|
||||
// state machine and cycle detection state
|
||||
@@ -857,7 +863,7 @@ typedef struct lfs3_mtrv {
|
||||
// opened file state
|
||||
lfs3_handle_t *h;
|
||||
// bshrub/btree traversal state
|
||||
lfs3_sbid_t bid;
|
||||
lfs3_btrv_t btrv;
|
||||
|
||||
// recalculate gcksum when traversing with ckmeta
|
||||
uint32_t gcksum;
|
||||
|
||||
Reference in New Issue
Block a user