This extends lfs_fs_gc to now handle three things:
Calls mkconsistent if not already consistent
Compacts metadata > compact_thresh
Populates the block allocator
Which should be all of the janitorial work that can be done without additional on-disk data structures.
Normally, metadata compaction occurs when an mdir is full, and results in mdirs that are at most block_size/2.
Now, if you call lfs_fs_gc, littlefs will eagerly compact any mdirs that exceed the compact_thresh configuration option. Because the resulting mdirs are at most block_size/2, it only makes sense for compact_thresh to be >= block_size/2 and <= block_size.
Additionally, there are some special values:
compact_thresh=0 => defaults to ~88% block_size, may change in the future
compact_thresh=-1 => disables metadata compaction during lfs_fs_gc
Note that compact_thresh only affects lfs_fs_gc. Normal compactions still only occur when full.
This extends
lfs_fs_gc
to now handle three things:compact_thresh
Which should be all of the janitorial work that can be done without additional on-disk data structures.
Normally, metadata compaction occurs when an mdir is full, and results in mdirs that are at most
block_size/2
.Now, if you call lfs_fs_gc, littlefs will eagerly compact any mdirs that exceed the
compact_thresh
configuration option. Because the resulting mdirs are at mostblock_size/2
, it only makes sense forcompact_thresh
to be >=block_size/2
and <=block_size
.Additionally, there are some special values:
compact_thresh=0
=> defaults to ~88%block_size
, may change in the futurecompact_thresh=-1
=> disables metadata compaction duringlfs_fs_gc
Note that
compact_thresh
only affectslfs_fs_gc
. Normal compactions still only occur when full.This depends on: https://github.com/littlefs-project/littlefs/pull/912