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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+46
-46
@@ -103,29 +103,29 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
// a few preconfigured defines that control how benches run
|
// a few preconfigured defines that control how benches run
|
||||||
#define BENCH_IMPLICIT_DEFINES \
|
#define BENCH_IMPLICIT_DEFINES \
|
||||||
/* name value (overridable) */ \
|
/* name value (overridable) */ \
|
||||||
BENCH_DEFINE(READ_SIZE, 1 ) \
|
BENCH_DEFINE(READ_SIZE, 1 ) \
|
||||||
BENCH_DEFINE(PROG_SIZE, 1 ) \
|
BENCH_DEFINE(PROG_SIZE, 1 ) \
|
||||||
BENCH_DEFINE(BLOCK_SIZE, 4096 ) \
|
BENCH_DEFINE(BLOCK_SIZE, 4096 ) \
|
||||||
BENCH_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
|
BENCH_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
|
||||||
BENCH_DEFINE(DISK_SIZE, 1024*1024 ) \
|
BENCH_DEFINE(DISK_SIZE, 1024*1024 ) \
|
||||||
BENCH_DEFINE(BLOCK_RECYCLES, -1 ) \
|
BENCH_DEFINE(BLOCK_RECYCLES, -1 ) \
|
||||||
BENCH_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
|
BENCH_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
|
||||||
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
||||||
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
||||||
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||||
BENCH_DEFINE(GC_FLAGS, 0 ) \
|
BENCH_DEFINE(GC_FLAGS, 0 ) \
|
||||||
BENCH_DEFINE(GC_STEPS, 0 ) \
|
BENCH_DEFINE(GC_STEPS, 0 ) \
|
||||||
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||||
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 ) \
|
||||||
BENCH_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
|
BENCH_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
|
||||||
BENCH_DEFINE(EMUBD_SEED, 0 )
|
BENCH_DEFINE(EMUBD_SEED, 0 )
|
||||||
|
|
||||||
// declare defines as global intmax_ts
|
// declare defines as global intmax_ts
|
||||||
#define BENCH_DEFINE(k, v) \
|
#define BENCH_DEFINE(k, v) \
|
||||||
@@ -136,43 +136,43 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
// map defines to cfg struct fields
|
// map defines to cfg struct fields
|
||||||
#define BENCH_CFG \
|
#define BENCH_CFG \
|
||||||
.read_size = READ_SIZE, \
|
.read_size = READ_SIZE, \
|
||||||
.prog_size = PROG_SIZE, \
|
.prog_size = PROG_SIZE, \
|
||||||
.block_size = BLOCK_SIZE, \
|
.block_size = BLOCK_SIZE, \
|
||||||
.block_count = BLOCK_COUNT, \
|
.block_count = BLOCK_COUNT, \
|
||||||
.block_recycles = BLOCK_RECYCLES, \
|
.block_recycles = BLOCK_RECYCLES, \
|
||||||
.rcache_size = RCACHE_SIZE, \
|
.rcache_size = RCACHE_SIZE, \
|
||||||
.pcache_size = PCACHE_SIZE, \
|
.pcache_size = PCACHE_SIZE, \
|
||||||
.file_cache_size = FILE_CACHE_SIZE, \
|
.file_cache_size = FILE_CACHE_SIZE, \
|
||||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||||
BENCH_GBMAP_CFG \
|
BENCH_GBMAP_CFG \
|
||||||
BENCH_GC_CFG \
|
BENCH_GC_CFG \
|
||||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||||
.inline_size = INLINE_SIZE, \
|
.inline_size = INLINE_SIZE, \
|
||||||
.fragment_size = FRAGMENT_SIZE, \
|
.fragment_size = FRAGMENT_SIZE, \
|
||||||
.crystal_thresh = CRYSTAL_THRESH,
|
.crystal_thresh = CRYSTAL_THRESH,
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
#ifdef LFS3_GC
|
#ifdef LFS3_GC
|
||||||
#define BENCH_GC_CFG \
|
#define BENCH_GC_CFG \
|
||||||
.gc_flags = GC_FLAGS, \
|
.gc_flags = GC_FLAGS, \
|
||||||
.gc_steps = GC_STEPS,
|
.gc_steps = GC_STEPS,
|
||||||
#else
|
#else
|
||||||
#define BENCH_GC_CFG
|
#define BENCH_GC_CFG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BENCH_BDCFG \
|
#define BENCH_BDCFG \
|
||||||
.erase_value = ERASE_VALUE, \
|
.erase_value = ERASE_VALUE, \
|
||||||
.erase_cycles = ERASE_CYCLES, \
|
.erase_cycles = ERASE_CYCLES, \
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||||
.seed = EMUBD_SEED,
|
.seed = EMUBD_SEED,
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+46
-46
@@ -94,29 +94,29 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
// a few preconfigured defines that control how tests run
|
// a few preconfigured defines that control how tests run
|
||||||
#define TEST_IMPLICIT_DEFINES \
|
#define TEST_IMPLICIT_DEFINES \
|
||||||
/* name value (overridable) */ \
|
/* name value (overridable) */ \
|
||||||
TEST_DEFINE(READ_SIZE, 1 ) \
|
TEST_DEFINE(READ_SIZE, 1 ) \
|
||||||
TEST_DEFINE(PROG_SIZE, 1 ) \
|
TEST_DEFINE(PROG_SIZE, 1 ) \
|
||||||
TEST_DEFINE(BLOCK_SIZE, 4096 ) \
|
TEST_DEFINE(BLOCK_SIZE, 4096 ) \
|
||||||
TEST_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
|
TEST_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
|
||||||
TEST_DEFINE(DISK_SIZE, 1024*1024 ) \
|
TEST_DEFINE(DISK_SIZE, 1024*1024 ) \
|
||||||
TEST_DEFINE(BLOCK_RECYCLES, -1 ) \
|
TEST_DEFINE(BLOCK_RECYCLES, -1 ) \
|
||||||
TEST_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
|
TEST_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
|
||||||
TEST_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
TEST_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
||||||
TEST_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
TEST_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
||||||
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||||
TEST_DEFINE(GC_FLAGS, 0 ) \
|
TEST_DEFINE(GC_FLAGS, 0 ) \
|
||||||
TEST_DEFINE(GC_STEPS, 0 ) \
|
TEST_DEFINE(GC_STEPS, 0 ) \
|
||||||
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||||
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 ) \
|
||||||
TEST_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
|
TEST_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
|
||||||
TEST_DEFINE(EMUBD_SEED, 0 )
|
TEST_DEFINE(EMUBD_SEED, 0 )
|
||||||
|
|
||||||
// declare defines as global intmax_ts
|
// declare defines as global intmax_ts
|
||||||
#define TEST_DEFINE(k, v) \
|
#define TEST_DEFINE(k, v) \
|
||||||
@@ -127,43 +127,43 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
|||||||
|
|
||||||
// map defines to cfg struct fields
|
// map defines to cfg struct fields
|
||||||
#define TEST_CFG \
|
#define TEST_CFG \
|
||||||
.read_size = READ_SIZE, \
|
.read_size = READ_SIZE, \
|
||||||
.prog_size = PROG_SIZE, \
|
.prog_size = PROG_SIZE, \
|
||||||
.block_size = BLOCK_SIZE, \
|
.block_size = BLOCK_SIZE, \
|
||||||
.block_count = BLOCK_COUNT, \
|
.block_count = BLOCK_COUNT, \
|
||||||
.block_recycles = BLOCK_RECYCLES, \
|
.block_recycles = BLOCK_RECYCLES, \
|
||||||
.rcache_size = RCACHE_SIZE, \
|
.rcache_size = RCACHE_SIZE, \
|
||||||
.pcache_size = PCACHE_SIZE, \
|
.pcache_size = PCACHE_SIZE, \
|
||||||
.file_cache_size = FILE_CACHE_SIZE, \
|
.file_cache_size = FILE_CACHE_SIZE, \
|
||||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||||
TEST_GBMAP_CFG \
|
TEST_GBMAP_CFG \
|
||||||
TEST_GC_CFG \
|
TEST_GC_CFG \
|
||||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||||
.inline_size = INLINE_SIZE, \
|
.inline_size = INLINE_SIZE, \
|
||||||
.fragment_size = FRAGMENT_SIZE, \
|
.fragment_size = FRAGMENT_SIZE, \
|
||||||
.crystal_thresh = CRYSTAL_THRESH,
|
.crystal_thresh = CRYSTAL_THRESH,
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
#ifdef LFS3_GC
|
#ifdef LFS3_GC
|
||||||
#define TEST_GC_CFG \
|
#define TEST_GC_CFG \
|
||||||
.gc_flags = GC_FLAGS, \
|
.gc_flags = GC_FLAGS, \
|
||||||
.gc_steps = GC_STEPS,
|
.gc_steps = GC_STEPS,
|
||||||
#else
|
#else
|
||||||
#define TEST_GC_CFG
|
#define TEST_GC_CFG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEST_BDCFG \
|
#define TEST_BDCFG \
|
||||||
.erase_value = ERASE_VALUE, \
|
.erase_value = ERASE_VALUE, \
|
||||||
.erase_cycles = ERASE_CYCLES, \
|
.erase_cycles = ERASE_CYCLES, \
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||||
.seed = EMUBD_SEED,
|
.seed = EMUBD_SEED,
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user