Made grm a special attribute, moved encoding into mdir commit
This is entirely a pragmatic change, lfsr_mdir_commit already does
several hairy things with grm tags, decoding, fixing, reencoding, etc,
so it makes sense to move all the encoding logic into lfsr_mdir_commit.
This leads to a couple optimizations:
- We don't need to decode the grm to apply any last minute fixes.
- By allowing the grm arugment to be mutated (they are just sitting on
the stack anyways, we need a copy in case we back out of change due to
error), we can apply and save any grm fixes in the grm argument
itself.
This means we only need to fix the grm at most once, after any mtree
modifications.
Which in turn saves some code and stack cost:
code stack
before: 22930 2392
after: 22706 (-1.0%) 2344 (-2.0%)
This commit is contained in:
@@ -499,11 +499,9 @@ typedef struct lfs {
|
||||
lfsr_mdir_t mroot;
|
||||
lfsr_btree_t mtree;
|
||||
|
||||
// TODO do we really need separate decoded/encoded grms?
|
||||
lfsr_grm_t grm_;
|
||||
|
||||
uint8_t grm[LFSR_GRM_DSIZE];
|
||||
uint8_t grmd[LFSR_GRM_DSIZE];
|
||||
lfsr_grm_t grm;
|
||||
uint8_t pgrm[LFSR_GRM_DSIZE];
|
||||
uint8_t dgrm[LFSR_GRM_DSIZE];
|
||||
|
||||
// linked-lists of opened mdirs, we keep a separate linked-list
|
||||
// for each type since these need to be handled a bit differently
|
||||
|
||||
Reference in New Issue
Block a user