bmap: The initial bmapcache algorithm seems to be working
At least at a proof-of-concept level, there's still a lot of cleanup
needed.
To make things work, lfs3_alloc_ckpoint now takes an mdir, which
provides the target for gbmap gstate updates.
When the bmap is close to empty (configurable via bmap_scan_thresh), we
opportunistically rebuild it during lfs3_alloc_ckpoints. The nice thing
about lfs3_alloc_ckpoint is we know the state of all in-flight blocks,
so rebuilding the bmap just requires traversing the filesystem + in-RAM
state.
We might still fall back to the lookahead buffer, but in theory a well
tuned bmap_scan_thresh can prevent this from becoming a bottleneck (at
the cost of more frequent bmap rebuilds).
---
This is also probably a good time to resume measuring code/ram costs,
though it's worth repeating the above note about the bmap work still
needing cleanup:
code stack ctx
before: 36840 2368 684
after: 36920 (+0.2%) 2368 (+0.0%) 684 (+0.0%)
Haha, no, the bmap isn't basically free, it's just an opt-in features.
With -DLFS3_YES_BMAP=1:
code stack ctx
no bmap: 36920 2368 684
yes bmap: 38552 (+4.4%) 2472 (+4.4%) 812 (+18.7%)
This commit is contained in:
@@ -121,6 +121,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
BENCH_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
|
||||
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||
BENCH_DEFINE(BMAP_SCAN_THRESH, BLOCK_COUNT/4 ) \
|
||||
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
|
||||
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
|
||||
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
||||
@@ -154,7 +155,8 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
#ifdef LFS3_BMAP
|
||||
#define BENCH_BMAP_CFG \
|
||||
.treediff_size = TREEDIFF_SIZE,
|
||||
.treediff_size = TREEDIFF_SIZE, \
|
||||
.bmap_scan_thresh = BMAP_SCAN_THRESH,
|
||||
#else
|
||||
#define BENCH_BMAP_CFG
|
||||
#endif
|
||||
|
||||
@@ -112,6 +112,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
TEST_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
|
||||
TEST_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||
TEST_DEFINE(BMAP_SCAN_THRESH, BLOCK_COUNT/4 ) \
|
||||
TEST_DEFINE(ERASE_VALUE, 0xff ) \
|
||||
TEST_DEFINE(ERASE_CYCLES, 0 ) \
|
||||
TEST_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
||||
@@ -145,7 +146,8 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
#ifdef LFS3_BMAP
|
||||
#define TEST_BMAP_CFG \
|
||||
.treediff_size = TREEDIFF_SIZE,
|
||||
.treediff_size = TREEDIFF_SIZE, \
|
||||
.bmap_scan_thresh = BMAP_SCAN_THRESH,
|
||||
#else
|
||||
#define TEST_BMAP_CFG
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user