gbmap: Renamed gbmap_scan_thresh -> gbmap_rebuild_thresh
I think a good rule of thumb is if you refer to some variable/config/ field with a different name in comments/writing/etc more often than not, you should just rename the variable/config/field to match. So yeah, gbmap_rebuild_thresh controls when the gbmap is rebuilt. Also touched up the doc comment a bit.
This commit is contained in:
@@ -10973,7 +10973,7 @@ static inline int lfs3_alloc_ckpoint(lfs3_t *lfs3) {
|
|||||||
// do we need to rebuild the gbmap?
|
// do we need to rebuild the gbmap?
|
||||||
if (lfs3_f_isgbmap(lfs3->flags)
|
if (lfs3_f_isgbmap(lfs3->flags)
|
||||||
&& lfs3->lookahead.gbmapped < lfs3_min(
|
&& lfs3->lookahead.gbmapped < lfs3_min(
|
||||||
lfs3->cfg->gbmap_scan_thresh,
|
lfs3->cfg->gbmap_rebuild_thresh,
|
||||||
lfs3->block_count)) {
|
lfs3->block_count)) {
|
||||||
int err = lfs3_alloc_rebuildgbmap(lfs3);
|
int err = lfs3_alloc_rebuildgbmap(lfs3);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -546,15 +546,16 @@ struct lfs3_cfg {
|
|||||||
lfs3_size_t crystal_thresh;
|
lfs3_size_t crystal_thresh;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Threshold for when to rebuild block-map information. littlefs
|
// Threshold for when to rebuild the global on-disk block-map (gbmap).
|
||||||
// will attempt to rebuild the block-map when fewer than this many
|
// littlefs will attempt to rebuild the gbmap when fewer than this
|
||||||
// blocks are known. Larger values rebuild the block-map more
|
// many blocks are known. Larger values rebuild the gbmap more
|
||||||
// frequently, reducing the chance of falling back to a slower
|
// frequently, reducing the chance of falling back to a slower
|
||||||
// allocator at a performance cost.
|
// allocator at the cost of amortized allocator throughput.
|
||||||
//
|
//
|
||||||
// 0 only rebuilds the block-map when empty.
|
// 0 only rebuilds the gbmap when empty, but note rebuilding the
|
||||||
|
// gbmap may require allocating blocks.
|
||||||
#ifdef LFS3_GBMAP
|
#ifdef LFS3_GBMAP
|
||||||
lfs3_block_t gbmap_scan_thresh;
|
lfs3_block_t gbmap_rebuild_thresh;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
BENCH_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
|
BENCH_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
|
||||||
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||||
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||||
BENCH_DEFINE(GBMAP_SCAN_THRESH, BLOCK_COUNT/4 ) \
|
BENCH_DEFINE(GBMAP_REBUILD_THRESH, BLOCK_COUNT/4 ) \
|
||||||
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
|
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
|
||||||
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
|
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
|
||||||
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
||||||
@@ -154,7 +154,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
#ifdef LFS3_GBMAP
|
#ifdef LFS3_GBMAP
|
||||||
#define BENCH_GBMAP_CFG \
|
#define BENCH_GBMAP_CFG \
|
||||||
.gbmap_scan_thresh = GBMAP_SCAN_THRESH,
|
.gbmap_rebuild_thresh = GBMAP_REBUILD_THRESH,
|
||||||
#else
|
#else
|
||||||
#define BENCH_GBMAP_CFG
|
#define BENCH_GBMAP_CFG
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
TEST_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
|
TEST_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
|
||||||
TEST_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
TEST_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||||
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||||
TEST_DEFINE(GBMAP_SCAN_THRESH, BLOCK_COUNT/4 ) \
|
TEST_DEFINE(GBMAP_REBUILD_THRESH, BLOCK_COUNT/4 ) \
|
||||||
TEST_DEFINE(ERASE_VALUE, 0xff ) \
|
TEST_DEFINE(ERASE_VALUE, 0xff ) \
|
||||||
TEST_DEFINE(ERASE_CYCLES, 0 ) \
|
TEST_DEFINE(ERASE_CYCLES, 0 ) \
|
||||||
TEST_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
TEST_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
||||||
@@ -145,7 +145,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
#ifdef LFS3_GBMAP
|
#ifdef LFS3_GBMAP
|
||||||
#define TEST_GBMAP_CFG \
|
#define TEST_GBMAP_CFG \
|
||||||
.gbmap_scan_thresh = GBMAP_SCAN_THRESH,
|
.gbmap_rebuild_thresh = GBMAP_REBUILD_THRESH,
|
||||||
#else
|
#else
|
||||||
#define TEST_GBMAP_CFG
|
#define TEST_GBMAP_CFG
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user