trv: Reduced LFS3_t_CKPOINTED + LFS3_t_MUTATED -> LFS3_t_CKPOINTED

This drops LFS3_t_MUTATED in favor of just using LFS3_t_CKPOINTED
everywhere:

1. These meant roughly the same thing, with LFS3_t_MUTATED being a bit
   tighter at the cost of needing to be explicitly set.

2. The implicit setting of LFS3_t_CKPOINTED by lfs3_alloc_ckpoint -- a
   function that already needs to be called before mutation -- means we
   have one less thing to worry about.

   Implicit properties like LFS3_t_CKPOINTED are great for building a
   reliable system. Manual flags like LFS3_t_MUTATED, not so much.

3. Why use two flags when we can get away with one?

The only downside is we may unnecessarily clobber gc/traversal work when
we don't actually mutate the filesystem. Failed file open calls are a
good example.

However this tradeoff seems well worth it for an overall simpler +
more reliable system.

---

Saves a bit of code:

                 code          stack          ctx
  before:       37220           2352          688
  after:        37160 (-0.2%)   2352 (+0.0%)  688 (+0.0%)

                 code          stack          ctx
  gbmap before: 40184           2368          856
  gbmap after:  40132 (-0.1%)   2368 (+0.0%)  856 (+0.0%)
This commit is contained in:
Christopher Haster
2025-10-20 15:35:03 -05:00
parent 5d70e47708
commit 8a58954828
4 changed files with 22 additions and 53 deletions
+5 -2
View File
@@ -2360,8 +2360,11 @@ code = '''
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
: 0)
| LFS3_I_COMPACTMETA
| LFS3_I_CKMETA
| LFS3_I_CKDATA
// and maybe ckmeta/ckdata, note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || SIZE > FILE_CACHE_SIZE || SYNC)
? LFS3_I_CKMETA : 0)
| ((!CKDATA || SIZE > FILE_CACHE_SIZE || SYNC)
? LFS3_I_CKDATA : 0)
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
// check the file contents