Introduced coalesce_size and crystallize_size, deduplicated test cfg
- coalesce_size - The amount of data allowed to coalesce into single data entries. - crystallize_size - How much data is allowed to be written to btree inner nodes before needing to be compacted into a block. Also deduplicated the test config is something I've been wanting to do for a while. It doesn't make sense to need to modify several different instantiations of lfs_config every time a config option is added or removed...
This commit is contained in:
@@ -8439,9 +8439,8 @@ static int lfsr_file_flushbuffer(lfs_t *lfs, lfsr_file_t *file) {
|
|||||||
- file->buffer_pos;
|
- file->buffer_pos;
|
||||||
if (left_overlap > 0
|
if (left_overlap > 0
|
||||||
|| (left_overlap == 0
|
|| (left_overlap == 0
|
||||||
// TODO use a different heuristic than cache_size here?
|
|
||||||
&& weight + lfsr_data_size(&left_data)
|
&& weight + lfsr_data_size(&left_data)
|
||||||
<= lfs->cfg->cache_size)) {
|
<= lfs->cfg->coalesce_size)) {
|
||||||
pos = left_rid - (left_weight-1);
|
pos = left_rid - (left_weight-1);
|
||||||
weight += file->buffer_pos - pos;
|
weight += file->buffer_pos - pos;
|
||||||
datas[0] = LFSR_DATA_DISK(
|
datas[0] = LFSR_DATA_DISK(
|
||||||
@@ -8479,10 +8478,8 @@ static int lfsr_file_flushbuffer(lfs_t *lfs, lfsr_file_t *file) {
|
|||||||
LFS_ASSERT(right_overlap >= 0);
|
LFS_ASSERT(right_overlap >= 0);
|
||||||
if (right_overlap > 0
|
if (right_overlap > 0
|
||||||
|| (right_overlap == 0
|
|| (right_overlap == 0
|
||||||
// TODO use a different heuristic than cache_size
|
|
||||||
// here?
|
|
||||||
&& weight + lfsr_data_size(&right_data)
|
&& weight + lfsr_data_size(&right_data)
|
||||||
<= lfs->cfg->cache_size)) {
|
<= lfs->cfg->coalesce_size)) {
|
||||||
// note physical right data size risks going negative here
|
// note physical right data size risks going negative here
|
||||||
// because of holes
|
// because of holes
|
||||||
weight += right_weight - right_overlap;
|
weight += right_weight - right_overlap;
|
||||||
@@ -8506,22 +8503,18 @@ static int lfsr_file_flushbuffer(lfs_t *lfs, lfsr_file_t *file) {
|
|||||||
if (lfsr_data_size(&datas[0])
|
if (lfsr_data_size(&datas[0])
|
||||||
+ lfsr_data_size(&datas[1])
|
+ lfsr_data_size(&datas[1])
|
||||||
+ lfsr_data_size(&datas[2])
|
+ lfsr_data_size(&datas[2])
|
||||||
// TODO use a different heuristic than cache_size here?
|
|
||||||
//
|
|
||||||
// make sure to never write null siblings, even when
|
// make sure to never write null siblings, even when
|
||||||
// buffer > cache size
|
// buffer > cache size
|
||||||
<= lfs_max32(lfs->cfg->cache_size, file->buffer_size)) {
|
<= lfs_max32(lfs->cfg->coalesce_size, file->buffer_size)) {
|
||||||
coalesce_attrs[0] = LFSR_ATTR(pos,
|
coalesce_attrs[0] = LFSR_ATTR(pos,
|
||||||
SHRUB(INLINED),
|
SHRUB(INLINED),
|
||||||
+weight,
|
+weight,
|
||||||
DATA(lfsr_data_fromcat(datas, 3)));
|
DATA(lfsr_data_fromcat(datas, 3)));
|
||||||
} else if (lfsr_data_size(&datas[0])
|
} else if (lfsr_data_size(&datas[0])
|
||||||
+ lfsr_data_size(&datas[1])
|
+ lfsr_data_size(&datas[1])
|
||||||
// TODO use a different heuristic than cache_size here?
|
|
||||||
//
|
|
||||||
// make sure to never write null siblings, even when
|
// make sure to never write null siblings, even when
|
||||||
// buffer > cache size
|
// buffer > cache size
|
||||||
<= lfs_max32(lfs->cfg->cache_size, file->buffer_size)) {
|
<= lfs_max32(lfs->cfg->coalesce_size, file->buffer_size)) {
|
||||||
coalesce_attrs[0] = LFSR_ATTR(pos,
|
coalesce_attrs[0] = LFSR_ATTR(pos,
|
||||||
SHRUB(INLINED),
|
SHRUB(INLINED),
|
||||||
+lfsr_data_size(&datas[0])
|
+lfsr_data_size(&datas[0])
|
||||||
@@ -8542,11 +8535,9 @@ static int lfsr_file_flushbuffer(lfs_t *lfs, lfsr_file_t *file) {
|
|||||||
DATA(datas[0]));
|
DATA(datas[0]));
|
||||||
if (lfsr_data_size(&datas[1])
|
if (lfsr_data_size(&datas[1])
|
||||||
+ lfsr_data_size(&datas[2])
|
+ lfsr_data_size(&datas[2])
|
||||||
// TODO use a different heuristic than cache_size here?
|
|
||||||
//
|
|
||||||
// make sure to never write null siblings, even when
|
// make sure to never write null siblings, even when
|
||||||
// buffer > cache size
|
// buffer > cache size
|
||||||
<= lfs_max32(lfs->cfg->cache_size, file->buffer_size)) {
|
<= lfs_max32(lfs->cfg->coalesce_size, file->buffer_size)) {
|
||||||
coalesce_attrs[1] = LFSR_ATTR(pos + lfsr_data_size(&datas[0]),
|
coalesce_attrs[1] = LFSR_ATTR(pos + lfsr_data_size(&datas[0]),
|
||||||
SHRUB(INLINED),
|
SHRUB(INLINED),
|
||||||
+weight - lfsr_data_size(&datas[0]),
|
+weight - lfsr_data_size(&datas[0]),
|
||||||
|
|||||||
@@ -279,7 +279,8 @@ struct lfs_config {
|
|||||||
|
|
||||||
// TODO document
|
// TODO document
|
||||||
lfs_size_t inline_size;
|
lfs_size_t inline_size;
|
||||||
lfs_size_t bud_size;
|
lfs_size_t coalesce_size;
|
||||||
|
lfs_size_t crystallize_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
// File info structure
|
// File info structure
|
||||||
|
|||||||
+2
-12
@@ -1381,25 +1381,15 @@ void perm_run(
|
|||||||
.prog = lfs_emubd_prog,
|
.prog = lfs_emubd_prog,
|
||||||
.erase = lfs_emubd_erase,
|
.erase = lfs_emubd_erase,
|
||||||
.sync = lfs_emubd_sync,
|
.sync = lfs_emubd_sync,
|
||||||
.read_size = READ_SIZE,
|
BENCH_CFG
|
||||||
.prog_size = PROG_SIZE,
|
|
||||||
.block_size = BLOCK_SIZE,
|
|
||||||
.block_count = BLOCK_COUNT,
|
|
||||||
.block_cycles = BLOCK_CYCLES,
|
|
||||||
.cache_size = CACHE_SIZE,
|
|
||||||
.inline_size = INLINE_SIZE,
|
|
||||||
.bud_size = BUD_SIZE,
|
|
||||||
.lookahead_size = LOOKAHEAD_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lfs_emubd_config bdcfg = {
|
struct lfs_emubd_config bdcfg = {
|
||||||
.erase_value = ERASE_VALUE,
|
|
||||||
.erase_cycles = ERASE_CYCLES,
|
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
|
||||||
.disk_path = bench_disk_path,
|
.disk_path = bench_disk_path,
|
||||||
.read_sleep = bench_read_sleep,
|
.read_sleep = bench_read_sleep,
|
||||||
.prog_sleep = bench_prog_sleep,
|
.prog_sleep = bench_prog_sleep,
|
||||||
.erase_sleep = bench_erase_sleep,
|
.erase_sleep = bench_erase_sleep,
|
||||||
|
BENCH_BDCFG
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = lfs_emubd_createcfg(&cfg, bench_disk_path, &bdcfg);
|
int err = lfs_emubd_createcfg(&cfg, bench_disk_path, &bdcfg);
|
||||||
|
|||||||
+30
-10
@@ -98,7 +98,7 @@ intmax_t bench_define(size_t define);
|
|||||||
|
|
||||||
// a few preconfigured defines that control how benches run
|
// a few preconfigured defines that control how benches run
|
||||||
|
|
||||||
#define BENCH_IMPLICIT_DEFINE_COUNT 14
|
#define BENCH_IMPLICIT_DEFINE_COUNT 15
|
||||||
#define BENCH_GEOMETRY_DEFINE_COUNT 3
|
#define BENCH_GEOMETRY_DEFINE_COUNT 3
|
||||||
|
|
||||||
#define READ_SIZE_i 0
|
#define READ_SIZE_i 0
|
||||||
@@ -108,13 +108,14 @@ intmax_t bench_define(size_t define);
|
|||||||
#define DISK_SIZE_i 4
|
#define DISK_SIZE_i 4
|
||||||
#define CACHE_SIZE_i 5
|
#define CACHE_SIZE_i 5
|
||||||
#define INLINE_SIZE_i 6
|
#define INLINE_SIZE_i 6
|
||||||
#define BUD_SIZE_i 7
|
#define COALESCE_SIZE_i 7
|
||||||
#define LOOKAHEAD_SIZE_i 8
|
#define CRYSTALLIZE_SIZE_i 8
|
||||||
#define BLOCK_CYCLES_i 9
|
#define LOOKAHEAD_SIZE_i 9
|
||||||
#define ERASE_VALUE_i 10
|
#define BLOCK_CYCLES_i 10
|
||||||
#define ERASE_CYCLES_i 11
|
#define ERASE_VALUE_i 11
|
||||||
#define BADBLOCK_BEHAVIOR_i 12
|
#define ERASE_CYCLES_i 12
|
||||||
#define POWERLOSS_BEHAVIOR_i 13
|
#define BADBLOCK_BEHAVIOR_i 13
|
||||||
|
#define POWERLOSS_BEHAVIOR_i 14
|
||||||
|
|
||||||
#define READ_SIZE bench_define(READ_SIZE_i)
|
#define READ_SIZE bench_define(READ_SIZE_i)
|
||||||
#define PROG_SIZE bench_define(PROG_SIZE_i)
|
#define PROG_SIZE bench_define(PROG_SIZE_i)
|
||||||
@@ -123,7 +124,8 @@ intmax_t bench_define(size_t define);
|
|||||||
#define DISK_SIZE bench_define(DISK_SIZE_i)
|
#define DISK_SIZE bench_define(DISK_SIZE_i)
|
||||||
#define CACHE_SIZE bench_define(CACHE_SIZE_i)
|
#define CACHE_SIZE bench_define(CACHE_SIZE_i)
|
||||||
#define INLINE_SIZE bench_define(INLINE_SIZE_i)
|
#define INLINE_SIZE bench_define(INLINE_SIZE_i)
|
||||||
#define BUD_SIZE bench_define(BUD_SIZE_i)
|
#define COALESCE_SIZE bench_define(COALESCE_SIZE_i)
|
||||||
|
#define CRYSTALLIZE_SIZE bench_define(CRYSTALLIZE_SIZE_i)
|
||||||
#define LOOKAHEAD_SIZE bench_define(LOOKAHEAD_SIZE_i)
|
#define LOOKAHEAD_SIZE bench_define(LOOKAHEAD_SIZE_i)
|
||||||
#define BLOCK_CYCLES bench_define(BLOCK_CYCLES_i)
|
#define BLOCK_CYCLES bench_define(BLOCK_CYCLES_i)
|
||||||
#define ERASE_VALUE bench_define(ERASE_VALUE_i)
|
#define ERASE_VALUE bench_define(ERASE_VALUE_i)
|
||||||
@@ -140,7 +142,8 @@ intmax_t bench_define(size_t define);
|
|||||||
BENCH_DEF(DISK_SIZE, 1024*1024 ) \
|
BENCH_DEF(DISK_SIZE, 1024*1024 ) \
|
||||||
BENCH_DEF(CACHE_SIZE, lfs_max(16, lfs_max(READ_SIZE, PROG_SIZE))) \
|
BENCH_DEF(CACHE_SIZE, lfs_max(16, lfs_max(READ_SIZE, PROG_SIZE))) \
|
||||||
BENCH_DEF(INLINE_SIZE, BLOCK_SIZE/8 ) \
|
BENCH_DEF(INLINE_SIZE, BLOCK_SIZE/8 ) \
|
||||||
BENCH_DEF(BUD_SIZE, BLOCK_SIZE/4 ) \
|
BENCH_DEF(COALESCE_SIZE, CACHE_SIZE ) \
|
||||||
|
BENCH_DEF(CRYSTALLIZE_SIZE, BLOCK_SIZE/4 ) \
|
||||||
BENCH_DEF(LOOKAHEAD_SIZE, 16 ) \
|
BENCH_DEF(LOOKAHEAD_SIZE, 16 ) \
|
||||||
BENCH_DEF(BLOCK_CYCLES, -1 ) \
|
BENCH_DEF(BLOCK_CYCLES, -1 ) \
|
||||||
BENCH_DEF(ERASE_VALUE, 0xff ) \
|
BENCH_DEF(ERASE_VALUE, 0xff ) \
|
||||||
@@ -156,5 +159,22 @@ intmax_t bench_define(size_t define);
|
|||||||
BENCH_GEO("nor", 1, 1, 4096 ) \
|
BENCH_GEO("nor", 1, 1, 4096 ) \
|
||||||
BENCH_GEO("nand", 4096, 4096, 32768 )
|
BENCH_GEO("nand", 4096, 4096, 32768 )
|
||||||
|
|
||||||
|
#define BENCH_CFG \
|
||||||
|
.read_size = READ_SIZE, \
|
||||||
|
.prog_size = PROG_SIZE, \
|
||||||
|
.block_size = BLOCK_SIZE, \
|
||||||
|
.block_count = BLOCK_COUNT, \
|
||||||
|
.block_cycles = BLOCK_CYCLES, \
|
||||||
|
.cache_size = CACHE_SIZE, \
|
||||||
|
.inline_size = INLINE_SIZE, \
|
||||||
|
.coalesce_size = COALESCE_SIZE, \
|
||||||
|
.crystallize_size = CRYSTALLIZE_SIZE, \
|
||||||
|
.lookahead_size = LOOKAHEAD_SIZE,
|
||||||
|
|
||||||
|
#define BENCH_BDCFG \
|
||||||
|
.erase_value = ERASE_VALUE, \
|
||||||
|
.erase_cycles = ERASE_CYCLES, \
|
||||||
|
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-60
@@ -1412,25 +1412,15 @@ static void run_powerloss_none(
|
|||||||
.prog = lfs_emubd_prog,
|
.prog = lfs_emubd_prog,
|
||||||
.erase = lfs_emubd_erase,
|
.erase = lfs_emubd_erase,
|
||||||
.sync = lfs_emubd_sync,
|
.sync = lfs_emubd_sync,
|
||||||
.read_size = READ_SIZE,
|
TEST_CFG
|
||||||
.prog_size = PROG_SIZE,
|
|
||||||
.block_size = BLOCK_SIZE,
|
|
||||||
.block_count = BLOCK_COUNT,
|
|
||||||
.block_cycles = BLOCK_CYCLES,
|
|
||||||
.cache_size = CACHE_SIZE,
|
|
||||||
.inline_size = INLINE_SIZE,
|
|
||||||
.bud_size = BUD_SIZE,
|
|
||||||
.lookahead_size = LOOKAHEAD_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lfs_emubd_config bdcfg = {
|
struct lfs_emubd_config bdcfg = {
|
||||||
.erase_value = ERASE_VALUE,
|
|
||||||
.erase_cycles = ERASE_CYCLES,
|
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
|
||||||
.disk_path = test_disk_path,
|
.disk_path = test_disk_path,
|
||||||
.read_sleep = test_read_sleep,
|
.read_sleep = test_read_sleep,
|
||||||
.prog_sleep = test_prog_sleep,
|
.prog_sleep = test_prog_sleep,
|
||||||
.erase_sleep = test_erase_sleep,
|
.erase_sleep = test_erase_sleep,
|
||||||
|
TEST_BDCFG
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
||||||
@@ -1483,21 +1473,10 @@ static void run_powerloss_linear(
|
|||||||
.prog = lfs_emubd_prog,
|
.prog = lfs_emubd_prog,
|
||||||
.erase = lfs_emubd_erase,
|
.erase = lfs_emubd_erase,
|
||||||
.sync = lfs_emubd_sync,
|
.sync = lfs_emubd_sync,
|
||||||
.read_size = READ_SIZE,
|
TEST_CFG
|
||||||
.prog_size = PROG_SIZE,
|
|
||||||
.block_size = BLOCK_SIZE,
|
|
||||||
.block_count = BLOCK_COUNT,
|
|
||||||
.block_cycles = BLOCK_CYCLES,
|
|
||||||
.cache_size = CACHE_SIZE,
|
|
||||||
.inline_size = INLINE_SIZE,
|
|
||||||
.bud_size = BUD_SIZE,
|
|
||||||
.lookahead_size = LOOKAHEAD_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lfs_emubd_config bdcfg = {
|
struct lfs_emubd_config bdcfg = {
|
||||||
.erase_value = ERASE_VALUE,
|
|
||||||
.erase_cycles = ERASE_CYCLES,
|
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
|
||||||
.disk_path = test_disk_path,
|
.disk_path = test_disk_path,
|
||||||
.read_sleep = test_read_sleep,
|
.read_sleep = test_read_sleep,
|
||||||
.prog_sleep = test_prog_sleep,
|
.prog_sleep = test_prog_sleep,
|
||||||
@@ -1506,6 +1485,7 @@ static void run_powerloss_linear(
|
|||||||
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
||||||
.powerloss_cb = powerloss_longjmp,
|
.powerloss_cb = powerloss_longjmp,
|
||||||
.powerloss_data = &powerloss_jmp,
|
.powerloss_data = &powerloss_jmp,
|
||||||
|
TEST_BDCFG
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
||||||
@@ -1571,21 +1551,10 @@ static void run_powerloss_log(
|
|||||||
.prog = lfs_emubd_prog,
|
.prog = lfs_emubd_prog,
|
||||||
.erase = lfs_emubd_erase,
|
.erase = lfs_emubd_erase,
|
||||||
.sync = lfs_emubd_sync,
|
.sync = lfs_emubd_sync,
|
||||||
.read_size = READ_SIZE,
|
TEST_CFG
|
||||||
.prog_size = PROG_SIZE,
|
|
||||||
.block_size = BLOCK_SIZE,
|
|
||||||
.block_count = BLOCK_COUNT,
|
|
||||||
.block_cycles = BLOCK_CYCLES,
|
|
||||||
.cache_size = CACHE_SIZE,
|
|
||||||
.inline_size = INLINE_SIZE,
|
|
||||||
.bud_size = BUD_SIZE,
|
|
||||||
.lookahead_size = LOOKAHEAD_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lfs_emubd_config bdcfg = {
|
struct lfs_emubd_config bdcfg = {
|
||||||
.erase_value = ERASE_VALUE,
|
|
||||||
.erase_cycles = ERASE_CYCLES,
|
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
|
||||||
.disk_path = test_disk_path,
|
.disk_path = test_disk_path,
|
||||||
.read_sleep = test_read_sleep,
|
.read_sleep = test_read_sleep,
|
||||||
.prog_sleep = test_prog_sleep,
|
.prog_sleep = test_prog_sleep,
|
||||||
@@ -1594,6 +1563,7 @@ static void run_powerloss_log(
|
|||||||
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
||||||
.powerloss_cb = powerloss_longjmp,
|
.powerloss_cb = powerloss_longjmp,
|
||||||
.powerloss_data = &powerloss_jmp,
|
.powerloss_data = &powerloss_jmp,
|
||||||
|
TEST_BDCFG
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
||||||
@@ -1657,21 +1627,10 @@ static void run_powerloss_cycles(
|
|||||||
.prog = lfs_emubd_prog,
|
.prog = lfs_emubd_prog,
|
||||||
.erase = lfs_emubd_erase,
|
.erase = lfs_emubd_erase,
|
||||||
.sync = lfs_emubd_sync,
|
.sync = lfs_emubd_sync,
|
||||||
.read_size = READ_SIZE,
|
TEST_CFG
|
||||||
.prog_size = PROG_SIZE,
|
|
||||||
.block_size = BLOCK_SIZE,
|
|
||||||
.block_count = BLOCK_COUNT,
|
|
||||||
.block_cycles = BLOCK_CYCLES,
|
|
||||||
.cache_size = CACHE_SIZE,
|
|
||||||
.inline_size = INLINE_SIZE,
|
|
||||||
.bud_size = BUD_SIZE,
|
|
||||||
.lookahead_size = LOOKAHEAD_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lfs_emubd_config bdcfg = {
|
struct lfs_emubd_config bdcfg = {
|
||||||
.erase_value = ERASE_VALUE,
|
|
||||||
.erase_cycles = ERASE_CYCLES,
|
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
|
||||||
.disk_path = test_disk_path,
|
.disk_path = test_disk_path,
|
||||||
.read_sleep = test_read_sleep,
|
.read_sleep = test_read_sleep,
|
||||||
.prog_sleep = test_prog_sleep,
|
.prog_sleep = test_prog_sleep,
|
||||||
@@ -1680,6 +1639,7 @@ static void run_powerloss_cycles(
|
|||||||
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
||||||
.powerloss_cb = powerloss_longjmp,
|
.powerloss_cb = powerloss_longjmp,
|
||||||
.powerloss_data = &powerloss_jmp,
|
.powerloss_data = &powerloss_jmp,
|
||||||
|
TEST_BDCFG
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
||||||
@@ -1841,21 +1801,10 @@ static void run_powerloss_exhaustive(
|
|||||||
.prog = lfs_emubd_prog,
|
.prog = lfs_emubd_prog,
|
||||||
.erase = lfs_emubd_erase,
|
.erase = lfs_emubd_erase,
|
||||||
.sync = lfs_emubd_sync,
|
.sync = lfs_emubd_sync,
|
||||||
.read_size = READ_SIZE,
|
TEST_CFG
|
||||||
.prog_size = PROG_SIZE,
|
|
||||||
.block_size = BLOCK_SIZE,
|
|
||||||
.block_count = BLOCK_COUNT,
|
|
||||||
.block_cycles = BLOCK_CYCLES,
|
|
||||||
.cache_size = CACHE_SIZE,
|
|
||||||
.inline_size = INLINE_SIZE,
|
|
||||||
.bud_size = BUD_SIZE,
|
|
||||||
.lookahead_size = LOOKAHEAD_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lfs_emubd_config bdcfg = {
|
struct lfs_emubd_config bdcfg = {
|
||||||
.erase_value = ERASE_VALUE,
|
|
||||||
.erase_cycles = ERASE_CYCLES,
|
|
||||||
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
|
||||||
.disk_path = test_disk_path,
|
.disk_path = test_disk_path,
|
||||||
.read_sleep = test_read_sleep,
|
.read_sleep = test_read_sleep,
|
||||||
.prog_sleep = test_prog_sleep,
|
.prog_sleep = test_prog_sleep,
|
||||||
@@ -1863,6 +1812,7 @@ static void run_powerloss_exhaustive(
|
|||||||
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
.powerloss_behavior = POWERLOSS_BEHAVIOR,
|
||||||
.powerloss_cb = powerloss_exhaustive_branch,
|
.powerloss_cb = powerloss_exhaustive_branch,
|
||||||
.powerloss_data = NULL,
|
.powerloss_data = NULL,
|
||||||
|
TEST_BDCFG
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
|
||||||
|
|||||||
+30
-10
@@ -97,7 +97,7 @@ intmax_t test_define(size_t define);
|
|||||||
|
|
||||||
// a few preconfigured defines that control how tests run
|
// a few preconfigured defines that control how tests run
|
||||||
|
|
||||||
#define TEST_IMPLICIT_DEFINE_COUNT 14
|
#define TEST_IMPLICIT_DEFINE_COUNT 15
|
||||||
#define TEST_GEOMETRY_DEFINE_COUNT 3
|
#define TEST_GEOMETRY_DEFINE_COUNT 3
|
||||||
|
|
||||||
#define READ_SIZE_i 0
|
#define READ_SIZE_i 0
|
||||||
@@ -107,13 +107,14 @@ intmax_t test_define(size_t define);
|
|||||||
#define DISK_SIZE_i 4
|
#define DISK_SIZE_i 4
|
||||||
#define CACHE_SIZE_i 5
|
#define CACHE_SIZE_i 5
|
||||||
#define INLINE_SIZE_i 6
|
#define INLINE_SIZE_i 6
|
||||||
#define BUD_SIZE_i 7
|
#define COALESCE_SIZE_i 7
|
||||||
#define LOOKAHEAD_SIZE_i 8
|
#define CRYSTALLIZE_SIZE_i 8
|
||||||
#define BLOCK_CYCLES_i 9
|
#define LOOKAHEAD_SIZE_i 9
|
||||||
#define ERASE_VALUE_i 10
|
#define BLOCK_CYCLES_i 10
|
||||||
#define ERASE_CYCLES_i 11
|
#define ERASE_VALUE_i 11
|
||||||
#define BADBLOCK_BEHAVIOR_i 12
|
#define ERASE_CYCLES_i 12
|
||||||
#define POWERLOSS_BEHAVIOR_i 13
|
#define BADBLOCK_BEHAVIOR_i 13
|
||||||
|
#define POWERLOSS_BEHAVIOR_i 14
|
||||||
|
|
||||||
#define READ_SIZE TEST_DEFINE(READ_SIZE_i)
|
#define READ_SIZE TEST_DEFINE(READ_SIZE_i)
|
||||||
#define PROG_SIZE TEST_DEFINE(PROG_SIZE_i)
|
#define PROG_SIZE TEST_DEFINE(PROG_SIZE_i)
|
||||||
@@ -122,7 +123,8 @@ intmax_t test_define(size_t define);
|
|||||||
#define DISK_SIZE TEST_DEFINE(DISK_SIZE_i)
|
#define DISK_SIZE TEST_DEFINE(DISK_SIZE_i)
|
||||||
#define CACHE_SIZE TEST_DEFINE(CACHE_SIZE_i)
|
#define CACHE_SIZE TEST_DEFINE(CACHE_SIZE_i)
|
||||||
#define INLINE_SIZE TEST_DEFINE(INLINE_SIZE_i)
|
#define INLINE_SIZE TEST_DEFINE(INLINE_SIZE_i)
|
||||||
#define BUD_SIZE TEST_DEFINE(BUD_SIZE_i)
|
#define COALESCE_SIZE TEST_DEFINE(COALESCE_SIZE_i)
|
||||||
|
#define CRYSTALLIZE_SIZE TEST_DEFINE(CRYSTALLIZE_SIZE_i)
|
||||||
#define LOOKAHEAD_SIZE TEST_DEFINE(LOOKAHEAD_SIZE_i)
|
#define LOOKAHEAD_SIZE TEST_DEFINE(LOOKAHEAD_SIZE_i)
|
||||||
#define BLOCK_CYCLES TEST_DEFINE(BLOCK_CYCLES_i)
|
#define BLOCK_CYCLES TEST_DEFINE(BLOCK_CYCLES_i)
|
||||||
#define ERASE_VALUE TEST_DEFINE(ERASE_VALUE_i)
|
#define ERASE_VALUE TEST_DEFINE(ERASE_VALUE_i)
|
||||||
@@ -139,7 +141,8 @@ intmax_t test_define(size_t define);
|
|||||||
TEST_DEF(DISK_SIZE, 1024*1024 ) \
|
TEST_DEF(DISK_SIZE, 1024*1024 ) \
|
||||||
TEST_DEF(CACHE_SIZE, lfs_max(16, lfs_max(READ_SIZE, PROG_SIZE)) ) \
|
TEST_DEF(CACHE_SIZE, lfs_max(16, lfs_max(READ_SIZE, PROG_SIZE)) ) \
|
||||||
TEST_DEF(INLINE_SIZE, BLOCK_SIZE/8 ) \
|
TEST_DEF(INLINE_SIZE, BLOCK_SIZE/8 ) \
|
||||||
TEST_DEF(BUD_SIZE, BLOCK_SIZE/4 ) \
|
TEST_DEF(COALESCE_SIZE, CACHE_SIZE ) \
|
||||||
|
TEST_DEF(CRYSTALLIZE_SIZE, BLOCK_SIZE/4 ) \
|
||||||
TEST_DEF(LOOKAHEAD_SIZE, 16 ) \
|
TEST_DEF(LOOKAHEAD_SIZE, 16 ) \
|
||||||
TEST_DEF(BLOCK_CYCLES, -1 ) \
|
TEST_DEF(BLOCK_CYCLES, -1 ) \
|
||||||
TEST_DEF(ERASE_VALUE, 0xff ) \
|
TEST_DEF(ERASE_VALUE, 0xff ) \
|
||||||
@@ -155,5 +158,22 @@ intmax_t test_define(size_t define);
|
|||||||
TEST_GEO("nor", 1, 1, 4096 ) \
|
TEST_GEO("nor", 1, 1, 4096 ) \
|
||||||
TEST_GEO("nand", 4096, 4096, 32768 )
|
TEST_GEO("nand", 4096, 4096, 32768 )
|
||||||
|
|
||||||
|
#define TEST_CFG \
|
||||||
|
.read_size = READ_SIZE, \
|
||||||
|
.prog_size = PROG_SIZE, \
|
||||||
|
.block_size = BLOCK_SIZE, \
|
||||||
|
.block_count = BLOCK_COUNT, \
|
||||||
|
.block_cycles = BLOCK_CYCLES, \
|
||||||
|
.cache_size = CACHE_SIZE, \
|
||||||
|
.inline_size = INLINE_SIZE, \
|
||||||
|
.coalesce_size = COALESCE_SIZE, \
|
||||||
|
.crystallize_size = CRYSTALLIZE_SIZE, \
|
||||||
|
.lookahead_size = LOOKAHEAD_SIZE,
|
||||||
|
|
||||||
|
#define TEST_BDCFG \
|
||||||
|
.erase_value = ERASE_VALUE, \
|
||||||
|
.erase_cycles = ERASE_CYCLES, \
|
||||||
|
.badblock_behavior = BADBLOCK_BEHAVIOR,
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user