gc: Dropped lfsr_gc_setflags/setsteps

Now that you can provide gc_flags/gc_steps in lfs_config, I think it's a
bit more clear that _mutating_ the flags/steps is a niche feature, and
not worth implementing/testing.

It raises the question why not have a similar lfsr_setflags or
lfsr_file_setflags, and the answer there is it would be a pain-in-the-
ass to make sure all possible corner cases are covered.

It actually already was a pain-in-the-ass to test lfsr_gcsetflags/
setsteps... but just because we already did the work is not a good
reason for keeping complexity around.

---

Note that most of the use cases for lfsr_gc_setflags/setsteps can be
covered by either remounting the filesystem or through the
lfsr_traversal_t APIs directly.

The end result is a bit of code savings when incremental gc is enabled:

                   code          stack          ctx
  default before: 37796           2608          620
  default after:  37796 (+0.0%)   2608 (+0.0%)  620 (+0.0%)

  gc before:      37944           2608          768
  gc after        37896 (-0.1%)   2608 (+0.0%)  768 (+0.0%)
This commit is contained in:
Christopher Haster
2025-01-06 23:21:42 -06:00
parent 1b3054db89
commit 0617244aa3
3 changed files with 0 additions and 807 deletions
-28
View File
@@ -14759,34 +14759,6 @@ int lfsr_traversal_rewind(lfs_t *lfs, lfsr_traversal_t *t) {
/// Incremental gc operations ///
#ifdef LFS_GC
int lfsr_gc_setflags(lfs_t *lfs, uint32_t flags) {
// unknown gc flags?
LFS_ASSERT((flags & ~(
LFS_GC_MTREEONLY
| LFS_GC_MKCONSISTENT
| LFS_GC_LOOKAHEAD
| LFS_GC_COMPACT
| LFS_GC_CKMETA
| LFS_GC_CKDATA)) == 0);
// clobber any existing traversals
if (lfsr_omdir_isopen(lfs, &lfs->gc.t.o.o)) {
lfsr_omdir_close(lfs, &lfs->gc.t.o.o);
}
lfs->gc.flags = flags;
return 0;
}
#endif
#ifdef LFS_GC
int lfsr_gc_setsteps(lfs_t *lfs, lfs_soff_t steps) {
lfs->gc.steps = steps;
return 0;
}
#endif
#ifdef LFS_GC
// perform any pending janitorial work
int lfsr_gc(lfs_t *lfs) {