[kvdb] Clear cache before setting kv to default (#282)
* fix: clear cache. * Update fdb_kvdb.c, remove sector cache clear. --------- Co-authored-by: shihang zhang <shihang.zhang.ext@siemens.com>
This commit is contained in:
parent
64b07d7c4c
commit
24305a9c76
|
@ -1397,6 +1397,13 @@ fdb_err_t fdb_kv_set_default(fdb_kvdb_t db)
|
||||||
|
|
||||||
/* lock the KV cache */
|
/* lock the KV cache */
|
||||||
db_lock(db);
|
db_lock(db);
|
||||||
|
|
||||||
|
#ifdef FDB_KV_USING_CACHE
|
||||||
|
for (i = 0; i < FDB_KV_CACHE_TABLE_SIZE; i++) {
|
||||||
|
db->kv_cache_table[i].addr = FDB_DATA_UNUSED;
|
||||||
|
}
|
||||||
|
#endif /* FDB_KV_USING_CACHE */
|
||||||
|
|
||||||
/* format all sectors */
|
/* format all sectors */
|
||||||
for (addr = 0; addr < db_max_size(db); addr += db_sec_size(db)) {
|
for (addr = 0; addr < db_max_size(db); addr += db_sec_size(db)) {
|
||||||
result = format_sector(db, addr, SECTOR_NOT_COMBINED);
|
result = format_sector(db, addr, SECTOR_NOT_COMBINED);
|
||||||
|
|
Loading…
Reference in New Issue