bmap: Enabled at least opportunistic bmap allocations

This doesn't fully replace the lookahead buffer, but at least augments
it with known bmap state when available.

To be honest, this is a minimal effort hack to try to get something
benchmarkable without dealing with all the catch-22 issues that a
self-support bmap allocator would encounter (allocating blocks for the
bmap requires a bmap, oh no).

Though now that I'm writing this, maybe this is a reasonable long-term
solution? Having the lookahead buffer to fall back on solves a lot of
problems, and, realistically, it's unlikely to be a performance
bottleneck unless the user has extreme write requests (>available
storage?).

---

Also tweaked field naming to be consistent between the bmap and
lookahead buffer.
This commit is contained in:
Christopher Haster
2025-07-28 01:11:48 -05:00
parent 838a4beee1
commit 71b9ad2412
4 changed files with 172 additions and 97 deletions
+3 -3
View File
@@ -56,7 +56,7 @@ code = '''
memset(lfs3.lookahead.buffer, 0, CFG->lookahead_size);
lfs3.lookahead.window = 2;
lfs3.lookahead.off = 0;
lfs3.lookahead.size = lfs3_min(8*CFG->lookahead_size,
lfs3.lookahead.known = lfs3_min(8*CFG->lookahead_size,
CFG->block_count-2);
lfs3_alloc_ckpoint(&lfs3);
@@ -2011,7 +2011,7 @@ code = '''
memset(lfs3.lookahead.buffer, 0, CFG->lookahead_size);
lfs3.lookahead.window = 2;
lfs3.lookahead.off = 0;
lfs3.lookahead.size = lfs3_min(8*CFG->lookahead_size,
lfs3.lookahead.known = lfs3_min(8*CFG->lookahead_size,
CFG->block_count-2);
lfs3_alloc_ckpoint(&lfs3);
@@ -3968,7 +3968,7 @@ code = '''
memset(lfs3.lookahead.buffer, 0, CFG->lookahead_size);
lfs3.lookahead.window = 2;
lfs3.lookahead.off = 0;
lfs3.lookahead.size = lfs3_min(8*CFG->lookahead_size,
lfs3.lookahead.known = lfs3_min(8*CFG->lookahead_size,
CFG->block_count-2);
lfs3_alloc_ckpoint(&lfs3);