Added internal LFS_F_CANLOOKAHEAD flag

This is equivalent to the user-facing LFS_I_CANLOOKAHEAD flag, but
explicitly set in lfs_alloc/lfs_alloc_markfree, rather than being
implied.

Usually, I prefer implicit state, as this means less things that can
fall out-of-sync if there is a filesystem bug, but for
LFS_F_CANLOOKAHEAD explicit state might be warranted.

The main benefit is we can take advantage of the matching F/GC bit
patterns to simplify lfsr_fs_gc's progress checks.

This ends up saving a bit of code:

           code          stack
  before: 36048           2696
  after:  35988 (-0.2%)   2696 (+0.0%)
This commit is contained in:
Christopher Haster
2024-07-25 17:39:06 -05:00
parent 0893c1f6be
commit b7e7313ef0
2 changed files with 32 additions and 28 deletions
+2
View File
@@ -166,6 +166,8 @@ enum lfs_type {
// internally used flags
#define LFS_F_ORPHANS 0x01000000 // Filesystem may have untracked orphans
#define LFS_F_CANLOOKAHEAD \
0x02000000 // Lookahead buffer is not full
#define LFS_F_UNCOMPACTED \
0x08000000 // Filesystem may have uncompacted metadata