mirror of
https://github.com/armink/FlashDB.git
synced 2026-09-22 23:15:57 +08:00
feat(kvdb) Support 256bit write granularity for kvdb (#396)
AutoTestCI / AutoTest (GRAN=1) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=128) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=256) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=32) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=64) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=8) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=1) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=128) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=256) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=32) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=64) (push) Has been cancelled
AutoTestCI / AutoTest (GRAN=8) (push) Has been cancelled
This commit is contained in:
@@ -7,7 +7,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
write_gran: [1, 8, 32, 64, 128]
|
||||
write_gran: [1, 8, 32, 64, 128, 256]
|
||||
env:
|
||||
TEST_BSP_ROOT: ../AutoTestBsp
|
||||
UTEST_RUNNER_PATH: ../UtestRunner
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#ifdef FDB_USING_FAL_MODE
|
||||
/* the flash write granularity, unit: bit
|
||||
* only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32f7)/ 128(stm32h5) */
|
||||
* only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32f7)/ 128(stm32h5)/ 256(stm32h7) */
|
||||
#define FDB_WRITE_GRAN /* @note you must define it for a value */
|
||||
#endif
|
||||
|
||||
|
||||
+8
-5
@@ -27,8 +27,8 @@
|
||||
#error "Please configure flash write granularity (in fdb_cfg.h)"
|
||||
#endif
|
||||
|
||||
#if FDB_WRITE_GRAN != 1 && FDB_WRITE_GRAN != 8 && FDB_WRITE_GRAN != 32 && FDB_WRITE_GRAN != 64 && FDB_WRITE_GRAN != 128
|
||||
#error "the write gran can be only setting as 1, 8, 32, 64 and 128"
|
||||
#if FDB_WRITE_GRAN != 1 && FDB_WRITE_GRAN != 8 && FDB_WRITE_GRAN != 32 && FDB_WRITE_GRAN != 64 && FDB_WRITE_GRAN != 128 && FDB_WRITE_GRAN != 256
|
||||
#error "the write gran can be only setting as 1, 8, 32, 64, 128 and 256"
|
||||
#endif
|
||||
|
||||
/* magic word(`F`, `D`, `B`, `1`) */
|
||||
@@ -109,6 +109,8 @@ struct sector_hdr_data {
|
||||
uint32_t reserved;
|
||||
#if (FDB_WRITE_GRAN == 64) || (FDB_WRITE_GRAN == 128)
|
||||
uint8_t padding[4]; /**< align padding for 64bit and 128bit write granularity */
|
||||
#elif (FDB_WRITE_GRAN == 256)
|
||||
uint8_t padding[20]; /**< align padding for 256bit write granularity */
|
||||
#endif
|
||||
};
|
||||
typedef struct sector_hdr_data *sector_hdr_data_t;
|
||||
@@ -122,9 +124,10 @@ struct kv_hdr_data {
|
||||
uint32_t value_len; /**< value length */
|
||||
#if (FDB_WRITE_GRAN == 64)
|
||||
uint8_t padding[4]; /**< align padding for 64bit write granularity */
|
||||
#endif
|
||||
#if (FDB_WRITE_GRAN == 128)
|
||||
uint8_t padding[12]; /**< align padding for 128bit write granularity */
|
||||
#elif (FDB_WRITE_GRAN == 128)
|
||||
uint8_t padding[12]; /**< align padding for 128bit write granularity */
|
||||
#elif (FDB_WRITE_GRAN == 256)
|
||||
uint8_t padding[15]; /**< align padding for 256bit write granularity */
|
||||
#endif
|
||||
};
|
||||
typedef struct kv_hdr_data *kv_hdr_data_t;
|
||||
|
||||
+18
-1
@@ -46,6 +46,18 @@
|
||||
#define TEST_ITER1_SECTORS 5
|
||||
#define TEST_ITER1_COUNT (TEST_ITER1_SECTORS * _TSIL_PER_SECTOR)
|
||||
|
||||
/* TSLs per sector when blob is logbuf-sized string */
|
||||
#define _TSIL_LOGBUF_ALIGN_SZ FDB_WG_ALIGN(sizeof(logbuf))
|
||||
#define _TSIL_PER_SECTOR_STR ((TEST_SECTOR_SIZE - _TSIL_SEC_HDR_SZ) \
|
||||
/ (_TSIL_IDX_DATA_SZ + _TSIL_LOGBUF_ALIGN_SZ))
|
||||
|
||||
/* Cap at 256 to avoid timeout on small write granularities (e.g. gran=1/8/32),
|
||||
* while still being dynamic enough to avoid ring-buffer wrap-around on large
|
||||
* granularities (e.g. gran=64/128/256). */
|
||||
#define TEST_TS_COUNT ((_TSIL_PER_SECTOR_STR * 14) < 256 \
|
||||
? (_TSIL_PER_SECTOR_STR * 14) : 256)
|
||||
|
||||
|
||||
struct test_tls_data {
|
||||
int data;
|
||||
fdb_time_t time;
|
||||
@@ -153,9 +165,14 @@ static void test_fdb_tsl_iter_by_time(void)
|
||||
static void test_fdb_tsl_query_count(void)
|
||||
{
|
||||
fdb_time_t from = 0, to = TEST_TS_COUNT * TEST_TIME_STEP;
|
||||
uint32_t count;
|
||||
|
||||
fdb_reboot();
|
||||
uassert_true(fdb_tsl_query_count(&test_tsdb, from, to, FDB_TSL_WRITE) == TEST_TS_COUNT);
|
||||
count = fdb_tsl_query_count(&test_tsdb, from, to, FDB_TSL_WRITE);
|
||||
rt_kprintf("query_count from=%d to=%d => %u, expected=%u\n",
|
||||
(int)from, (int)to, (unsigned)count, TEST_TS_COUNT);
|
||||
|
||||
uassert_true(count == TEST_TS_COUNT);
|
||||
}
|
||||
|
||||
static bool est_fdb_tsl_set_status_cb(fdb_tsl_t tsl, void *arg)
|
||||
|
||||
Reference in New Issue
Block a user