Attempted to optimized lfsr_file_t by moving the cfg field first

Because of the invasive linked-lists, this was a bit more complicated
than the related move in lfs_t. But we already have similar
field-relative offsets in lfsr_dir_t for the dir + bookmark mdirs.

Added some helpers to help with this:

- lfsr_opened_dir
- lfsr_opened_constdir
- lfsr_opened_bookmark
- lfsr_opened_constbookmark
- lfsr_opened_file
- lfsr_opened_constfile

Unfortunately this resulted in less savings than in lfs_t, and actually
costs us code, likely because of how often we go from lfsr_file_t <->
lfsr_opened_t:

           code          stack
  before: 33358           2632
  after:  33402 (+0.1%)   2632 (+0.0%)
This commit is contained in:
Christopher Haster
2024-05-15 02:20:47 -05:00
parent 7980d0e21f
commit 8c4863f13e
2 changed files with 177 additions and 149 deletions
+1 -1
View File
@@ -510,8 +510,8 @@ typedef struct lfsr_bshrub {
} lfsr_bshrub_t;
typedef struct lfsr_file {
lfsr_opened_t m;
const struct lfs_file_config *cfg;
lfsr_opened_t m;
// files contain both an active bshrub and staging bshrub, to allow
// staging during mdir compacts