preerase: Inverted LFS3_PREERASE to be opt-in

The original motivation for making LFS3_PREERASE opt-out, is that it
makes sense for LFS3_GBMAP to bring in all gbmap-related features
(PREERASE, BADBLOCKS (future)). However, after a bit of use, I think
this just complicates our ifdef logic too much.

So instead, LFS3_PREERASE is now opt-in, with the intention of making
all ifdefs relative only to the default build. I think this will make it
easier to reason about ifdefs, at least internally.

Eventually, I want to look into alternative default builds (LFS3_BIGGER,
LFS3_BIGGERR, ..., LFS3_BIGGEST), which would provide an alternative way
to enable all gbmap-related features. Though these builds have a
high-risk of bikeshedding (LFS3_GC?), so we'll see.

---

That being said, the main ergonomic improvement was probably adding
a #error, so we don't have to check ifdef GBMAP everywhere.

Maybe this should be extended to LFS3_RDONLY? Or maybe not, LFS3_RDONLY
is a bit of a special case.

No code changes:

                    code          stack          ctx
  before:          35144           2136          660
  after:           35144 (+0.0%)   2136 (+0.0%)  660 (+0.0%)

                    code          stack          ctx
  gbmap before:    38380           2144          776
  gbmap after:     38380 (+0.0%)   2144 (+0.0%)  776 (+0.0%)

                    code          stack          ctx
  preerase before: 38920           2168          796
  preerase after:  38920 (+0.0%)   2168 (+0.0%)  796 (+0.0%)
This commit is contained in:
Christopher Haster
2025-12-30 00:28:38 -06:00
parent 1d6fa2e5f1
commit ecd780a313
5 changed files with 74 additions and 112 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
#define BENCH_GBMAP_CFG
#endif
#if defined(LFS3_GBMAP) && !defined(LFS3_NO_PREERASE)
#ifdef LFS3_PREERASE
#define BENCH_PREERASE_CFG \
.gc_preerase_count = GC_PREERASE_COUNT,
#else
+1 -1
View File
@@ -156,7 +156,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
#define TEST_GBMAP_CFG
#endif
#if defined(LFS3_GBMAP) && !defined(LFS3_NO_PREERASE)
#ifdef LFS3_PREERASE
#define TEST_PREERASE_CFG \
.gc_preerase_count = GC_PREERASE_COUNT,
#else