mirror of
https://github.com/armink/FlashDB.git
synced 2025-01-29 04:32:53 +08:00
Merge pull request #247 from guoweilkd/master
fix db_lock()/db_unlock() not calling in pairs
This commit is contained in:
commit
530cffcab1
@ -29,9 +29,9 @@
|
|||||||
/* Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4)
|
/* Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4)
|
||||||
* would return 16.
|
* would return 16.
|
||||||
*/
|
*/
|
||||||
#define FDB_ALIGN(size, align) ((size + align - 1) - ((size + align -1) % align))
|
#define FDB_ALIGN(size, align) (((size) + (align) - 1) - (((size) + (align) -1) % (align)))
|
||||||
/* align by write granularity */
|
/* align by write granularity */
|
||||||
#define FDB_WG_ALIGN(size) (FDB_ALIGN(size, (FDB_WRITE_GRAN + 7)/8))
|
#define FDB_WG_ALIGN(size) (FDB_ALIGN(size, ((FDB_WRITE_GRAN + 7)/8)))
|
||||||
/**
|
/**
|
||||||
* Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4)
|
* Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4)
|
||||||
* would return 12.
|
* would return 12.
|
||||||
|
@ -1597,8 +1597,7 @@ static fdb_err_t _fdb_kv_load(fdb_kvdb_t db)
|
|||||||
/* check all sector header */
|
/* check all sector header */
|
||||||
sector_iterator(db, §or, FDB_SECTOR_STORE_UNUSED, &check_failed_count, db, check_sec_hdr_cb, false);
|
sector_iterator(db, §or, FDB_SECTOR_STORE_UNUSED, &check_failed_count, db, check_sec_hdr_cb, false);
|
||||||
if (db->parent.not_formatable && check_failed_count > 0) {
|
if (db->parent.not_formatable && check_failed_count > 0) {
|
||||||
result = FDB_READ_ERR;
|
return FDB_READ_ERR;
|
||||||
goto __exit;
|
|
||||||
}
|
}
|
||||||
/* all sector header check failed */
|
/* all sector header check failed */
|
||||||
if (check_failed_count == SECTOR_NUM) {
|
if (check_failed_count == SECTOR_NUM) {
|
||||||
@ -1621,7 +1620,6 @@ __retry:
|
|||||||
|
|
||||||
db->in_recovery_check = false;
|
db->in_recovery_check = false;
|
||||||
|
|
||||||
__exit:
|
|
||||||
/* unlock the KV cache */
|
/* unlock the KV cache */
|
||||||
db_unlock(db);
|
db_unlock(db);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user