gc: Reverted to only consider ckmeta/ckdata done if not mutated

Two main reasons:

1. If we mount without ckprogs, we do actually have a pretty decent hole
   here where data can be written with errors and go unchecked during
   lfsr_fs_gc.

2. If we're traversing a btree that gets mutated mid-traversal, we're
   kicked entirely off the btree. This means we could miss large ranges
   of btree nodes/data blocks that may not have themselves been mutated.
   Not great.

Worst case, it doesn't hurt to check things again if the filesystem
changes. If this is too much of a bottleneck, you should probably be
running gc in incremental mode anyways, which always starts a new
traversal on ckmeta/ckdata.

Checking for dirty/mutated doesn't really add that much code:

           code          stack
  before: 36240           2680
  after:  36256 (+0.0%)   2680 (+0.0%)
This commit is contained in:
Christopher Haster
2024-07-19 02:49:57 -05:00
parent 15090e5dcf
commit 51fa5b9831
+6 -4
View File
@@ -13129,10 +13129,12 @@ int lfsr_fs_gc(lfs_t *lfs, lfs_soff_t steps, uint32_t flags) {
| ((!lfsr_i_isuncompacted(lfs->flags))
? LFS_GC_COMPACT
: 0)
// consider our filesystem checked if we complete at
// least one traversal
| LFS_GC_CKMETA
| LFS_GC_CKDATA);
// only consider our filesystem checked if we
// weren't mutated
| ((!lfsr_f_isdirty(lfs->gc.o.o.flags)
&& !lfsr_f_ismutated(lfs->gc.o.o.flags))
? LFS_GC_CKMETA | LFS_GC_CKDATA
: 0));
}
// decrement steps