From d1e79bffc7acd2deff7743dc1cd3db67d131efbb Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 23 Oct 2023 12:27:44 -0500 Subject: [PATCH] Renamed crystallize_size -> crystal_size The original name was a bit of a mouthful. Also dropped the default crystal_size in the test/bench runners block_size/4 -> block_size/8. I'm already noticing large amounts of inflation when blocks are fragmented, though I am experimenting with a rather small fragment_size right now. Future benchmarks/experimentation is required to figure out good values for these. --- lfs.c | 2 +- lfs.h | 2 +- runners/bench_runner.h | 8 ++++---- runners/test_runner.h | 8 ++++---- tests/test_alloc.toml | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lfs.c b/lfs.c index 836d3100..5100205f 100644 --- a/lfs.c +++ b/lfs.c @@ -10592,7 +10592,7 @@ static int lfsr_file_flushshrub(lfs_t *lfs, lfsr_file_t *file) { // holes we don't account for, but we generally don't want a bunch of // small holes in our files anyways. // - if (right_align - left_align > lfs->cfg->crystallize_size) { + if (right_align - left_align > lfs->cfg->crystal_size) { // allocate a new block lfs_block_t block; int err = lfs_alloc(lfs, &block); diff --git a/lfs.h b/lfs.h index 5409fd6f..186dc6ae 100644 --- a/lfs.h +++ b/lfs.h @@ -280,7 +280,7 @@ struct lfs_config { // TODO document lfs_size_t inline_size; lfs_size_t fragment_size; - lfs_size_t crystallize_size; + lfs_size_t crystal_size; }; // File info structure diff --git a/runners/bench_runner.h b/runners/bench_runner.h index a1c2c28c..816fe7e2 100644 --- a/runners/bench_runner.h +++ b/runners/bench_runner.h @@ -109,7 +109,7 @@ intmax_t bench_define(size_t define); #define CACHE_SIZE_i 5 #define INLINE_SIZE_i 6 #define FRAGMENT_SIZE_i 7 -#define CRYSTALLIZE_SIZE_i 8 +#define CRYSTAL_SIZE_i 8 #define LOOKAHEAD_SIZE_i 9 #define BLOCK_CYCLES_i 10 #define ERASE_VALUE_i 11 @@ -125,7 +125,7 @@ intmax_t bench_define(size_t define); #define CACHE_SIZE bench_define(CACHE_SIZE_i) #define INLINE_SIZE bench_define(INLINE_SIZE_i) #define FRAGMENT_SIZE bench_define(FRAGMENT_SIZE_i) -#define CRYSTALLIZE_SIZE bench_define(CRYSTALLIZE_SIZE_i) +#define CRYSTAL_SIZE bench_define(CRYSTAL_SIZE_i) #define LOOKAHEAD_SIZE bench_define(LOOKAHEAD_SIZE_i) #define BLOCK_CYCLES bench_define(BLOCK_CYCLES_i) #define ERASE_VALUE bench_define(ERASE_VALUE_i) @@ -143,7 +143,7 @@ intmax_t bench_define(size_t define); BENCH_DEF(CACHE_SIZE, lfs_max(16, lfs_max(READ_SIZE, PROG_SIZE))) \ BENCH_DEF(INLINE_SIZE, BLOCK_SIZE/8 ) \ BENCH_DEF(FRAGMENT_SIZE, CACHE_SIZE ) \ - BENCH_DEF(CRYSTALLIZE_SIZE, BLOCK_SIZE/4 ) \ + BENCH_DEF(CRYSTAL_SIZE, BLOCK_SIZE/8 ) \ BENCH_DEF(LOOKAHEAD_SIZE, 16 ) \ BENCH_DEF(BLOCK_CYCLES, -1 ) \ BENCH_DEF(ERASE_VALUE, 0xff ) \ @@ -168,7 +168,7 @@ intmax_t bench_define(size_t define); .cache_size = CACHE_SIZE, \ .inline_size = INLINE_SIZE, \ .fragment_size = FRAGMENT_SIZE, \ - .crystallize_size = CRYSTALLIZE_SIZE, \ + .crystal_size = CRYSTAL_SIZE, \ .lookahead_size = LOOKAHEAD_SIZE, #define BENCH_BDCFG \ diff --git a/runners/test_runner.h b/runners/test_runner.h index 89cc37c5..bb9caba0 100644 --- a/runners/test_runner.h +++ b/runners/test_runner.h @@ -109,7 +109,7 @@ intmax_t test_define(size_t define); #define CACHE_SIZE_i 5 #define INLINE_SIZE_i 6 #define FRAGMENT_SIZE_i 7 -#define CRYSTALLIZE_SIZE_i 8 +#define CRYSTAL_SIZE_i 8 #define LOOKAHEAD_SIZE_i 9 #define BLOCK_CYCLES_i 10 #define ERASE_VALUE_i 11 @@ -125,7 +125,7 @@ intmax_t test_define(size_t define); #define CACHE_SIZE TEST_DEFINE(CACHE_SIZE_i) #define INLINE_SIZE TEST_DEFINE(INLINE_SIZE_i) #define FRAGMENT_SIZE TEST_DEFINE(FRAGMENT_SIZE_i) -#define CRYSTALLIZE_SIZE TEST_DEFINE(CRYSTALLIZE_SIZE_i) +#define CRYSTAL_SIZE TEST_DEFINE(CRYSTAL_SIZE_i) #define LOOKAHEAD_SIZE TEST_DEFINE(LOOKAHEAD_SIZE_i) #define BLOCK_CYCLES TEST_DEFINE(BLOCK_CYCLES_i) #define ERASE_VALUE TEST_DEFINE(ERASE_VALUE_i) @@ -143,7 +143,7 @@ intmax_t test_define(size_t define); TEST_DEF(CACHE_SIZE, lfs_max(16, lfs_max(READ_SIZE, PROG_SIZE)) ) \ TEST_DEF(INLINE_SIZE, BLOCK_SIZE/8 ) \ TEST_DEF(FRAGMENT_SIZE, CACHE_SIZE ) \ - TEST_DEF(CRYSTALLIZE_SIZE, BLOCK_SIZE/4 ) \ + TEST_DEF(CRYSTAL_SIZE, BLOCK_SIZE/8 ) \ TEST_DEF(LOOKAHEAD_SIZE, 16 ) \ TEST_DEF(BLOCK_CYCLES, -1 ) \ TEST_DEF(ERASE_VALUE, 0xff ) \ @@ -168,7 +168,7 @@ intmax_t test_define(size_t define); .cache_size = CACHE_SIZE, \ .inline_size = INLINE_SIZE, \ .fragment_size = FRAGMENT_SIZE, \ - .crystallize_size = CRYSTALLIZE_SIZE, \ + .crystal_size = CRYSTAL_SIZE, \ .lookahead_size = LOOKAHEAD_SIZE, #define TEST_BDCFG \ diff --git a/tests/test_alloc.toml b/tests/test_alloc.toml index 0c7d4220..d07e4344 100644 --- a/tests/test_alloc.toml +++ b/tests/test_alloc.toml @@ -184,7 +184,7 @@ code = ''' seen[tinfo.u.mdir.u.m.blocks[0] / 8] |= 1 << (tinfo.u.mdir.u.m.blocks[0] % 8); - } else if (tinfo.tag == LFSR_TAG_BTREE) { + } else if (tinfo.tag == LFSR_TAG_BRANCH) { printf("traversal: 0x%x btree 0x%x.%x\n", tinfo.tag, tinfo.u.rbyd.block, tinfo.u.rbyd.trunk); @@ -339,7 +339,7 @@ code = ''' seen[tinfo.u.mdir.u.m.blocks[0] / 8] |= 1 << (tinfo.u.mdir.u.m.blocks[0] % 8); - } else if (tinfo.tag == LFSR_TAG_BTREE) { + } else if (tinfo.tag == LFSR_TAG_BRANCH) { printf("traversal: 0x%x btree 0x%x.%x\n", tinfo.tag, tinfo.u.rbyd.block, tinfo.u.rbyd.trunk); @@ -484,7 +484,7 @@ code = ''' seen[tinfo.u.mdir.u.m.blocks[0] / 8] |= 1 << (tinfo.u.mdir.u.m.blocks[0] % 8); - } else if (tinfo.tag == LFSR_TAG_BTREE) { + } else if (tinfo.tag == LFSR_TAG_BRANCH) { printf("traversal: 0x%x btree 0x%x.%x\n", tinfo.tag, tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);