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:
@@ -843,8 +843,8 @@ typedef struct lfs3_grm {
|
||||
} lfs3_grm_t;
|
||||
|
||||
// gbmap encoding:
|
||||
// .---+- -+- -+- -+- -. cursor: 1 leb128 <=5 bytes
|
||||
// | cursor | known: 1 leb128 <=5 bytes
|
||||
// .---+- -+- -+- -+- -. window: 1 leb128 <=5 bytes
|
||||
// | window | known: 1 leb128 <=5 bytes
|
||||
// +---+- -+- -+- -+- -+ block: 1 leb128 <=5 bytes
|
||||
// | known | trunk: 1 leb128 <=4 bytes
|
||||
// +---+- -+- -+- -+- -+ cksum: 1 le32 4 bytes
|
||||
@@ -857,7 +857,7 @@ typedef struct lfs3_grm {
|
||||
#define LFS3_GBMAP_DSIZE (5+5+5+4+4)
|
||||
|
||||
typedef struct lfs3_gbmap {
|
||||
lfs3_block_t cursor;
|
||||
lfs3_block_t window;
|
||||
lfs3_block_t known;
|
||||
lfs3_btree_t b;
|
||||
} lfs3_gbmap_t;
|
||||
@@ -916,8 +916,11 @@ typedef struct lfs3 {
|
||||
struct lfs3_lookahead {
|
||||
lfs3_block_t window;
|
||||
lfs3_block_t off;
|
||||
lfs3_block_t size;
|
||||
lfs3_block_t known;
|
||||
lfs3_block_t ckpoint;
|
||||
#ifdef LFS3_BMAP
|
||||
lfs3_block_t bmapped;
|
||||
#endif
|
||||
uint8_t *buffer;
|
||||
} lookahead;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user