Added lfsr_mtree_t, store direct mptrs decoded
This gives the mtree a dedicated type, with direct mptrs (single mdirs)
being stored decoded, instead of encoding into leb128s. This avoids
encoding/decoding in some cases.
This change is currently a net downgrade, but only because we still have
all of the inlined btree code. Eventually this inlined btree code should
be removed:
code stack
before: 31316 2064
after: 31480 (+0.5%) 2072 (+0.4%)
Also tweaked the tests to no longer test dropping the mtree down to
zero size. Thanks to root bookmarks, we never actually do this, and it
simplifies lfsr_mdir_commit to not support this.
This commit is contained in:
@@ -595,6 +595,19 @@ typedef struct lfs_gstate {
|
||||
lfs_block_t pair[2];
|
||||
} lfs_gstate_t;
|
||||
|
||||
typedef struct lfsr_mtree {
|
||||
union {
|
||||
// the sign bit indicates if this is an inlined mdir/direct mdir
|
||||
// pointer or a full mtree
|
||||
lfsr_smid_t weight;
|
||||
struct {
|
||||
lfsr_smid_t weight;
|
||||
lfs_block_t blocks[2];
|
||||
} mptr;
|
||||
lfsr_btree_t btree;
|
||||
} u;
|
||||
} lfsr_mtree_t;
|
||||
|
||||
// The littlefs filesystem type
|
||||
typedef struct lfs {
|
||||
lfs_cache_t rcache;
|
||||
@@ -634,7 +647,7 @@ typedef struct lfs {
|
||||
|
||||
uint8_t mleaf_bits;
|
||||
lfsr_mdir_t mroot;
|
||||
lfsr_btree_t mtree;
|
||||
lfsr_mtree_t mtree;
|
||||
|
||||
// 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