Made lfsr_shrub_t its own struct

This now properly encodes the different eoff/estimate field usage
between the two types.

In theory this could save some RAM, but we don't actually allocate
lfsr_shrub_t anywhere it's not unioned with lfsr_btree_t, so:

           code          stack
  before: 33976           2824
  after:  33976 (+0.0%)   2824 (+0.0%)
This commit is contained in:
Christopher Haster
2024-05-02 02:12:38 -05:00
parent 45a4e9ffb4
commit 0ed38211bf
2 changed files with 45 additions and 24 deletions
+10 -8
View File
@@ -355,6 +355,16 @@ typedef struct lfsr_rbyd {
// a btree is just the root rbyd
typedef lfsr_rbyd_t lfsr_btree_t;
// a shrub is a secondary trunk in an mdir
typedef struct {
// this mostly lines up with lfsr_rbyd_t
lfsr_rid_t weight;
lfs_block_t blocks[2];
lfs_ssize_t trunk;
// except for shrub estimate, which takes the place of eoff, etc
lfs_size_t estimate;
} lfsr_shrub_t;
typedef struct lfsr_mptr {
lfs_block_t blocks[2];
} lfsr_mptr_t;
@@ -464,14 +474,6 @@ typedef struct lfsr_bptr {
uint32_t cksum;
} lfsr_bptr_t;
// a shrub is a secondary trunk in an mdir
//
// note:
// - sign(trunk)=1 => shrub
// - we shove our shrub estimate into rbyd.eoff, C makes it too annoying
// to union another field
typedef lfsr_rbyd_t lfsr_shrub_t;
// the lfsr_bshrub_t struct represents the on-disk component of a file
typedef struct lfsr_bshrub {
// navigating this union is a bit tricky, and relies on the related