gc: Added more tests over info flags, dropped gc_flags default
Since we dropped lfsr_gc_setflags/setsteps, it was no longer possible to
set gc_flags to zero (perfectly valid and useful for system bringup/
testing things). Supporting gc_flags=0 means it's not possible to
provide a default, but this is probably ok as users need to opt-in to
LFS_GC anyways.
Note that at least gc_steps=0 doesn't make sense, so the default there
is reasonable.
Fixing this also highlighted that gc_flags/steps are no longer mutable,
making the comment in lfs_init out-of-date. Dropping these saves a bit
of lfs_t size, so that's nice.
And then testing also revealed that LFS_GC_CKDATA implying LFS_GC_CKDATA
means it should probably clear the LFS_I_CKMETA flag as well.
---
And here I thought this was going to be just a simple test-writing
exercise!
Code changes:
code stack ctx
default before: 37792 2608 620
default after: 37792 (-0.0%) 2608 (+0.0%) 620 (+0.0%)
gc before: 37896 2608 768
gc after: 37848 (-0.1%) 2608 (+0.0%) 760 (-1.0%)
This commit is contained in:
@@ -349,9 +349,6 @@ struct lfs_config {
|
||||
|
||||
#ifdef LFS_GC
|
||||
// Flags indicating what gc work to do during lfsr_gc calls.
|
||||
//
|
||||
// Defaults to LFS_GC_MKCONSISTENT + LFS_GC_LOOKAHEAD +
|
||||
// LFS_GC_COMPACT when zero.
|
||||
uint32_t gc_flags;
|
||||
#endif
|
||||
|
||||
@@ -880,8 +877,6 @@ typedef struct lfs {
|
||||
|
||||
#ifdef LFS_GC
|
||||
struct {
|
||||
uint32_t flags;
|
||||
lfs_soff_t steps;
|
||||
lfsr_traversal_t t;
|
||||
} gc;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user