Skip to content

Commit

Permalink
Merge pull request #247 from guoweilkd/master
Browse files Browse the repository at this point in the history
fix db_lock()/db_unlock() not calling in pairs
  • Loading branch information
armink authored Oct 12, 2023
2 parents 56b658e + 4aa2dbc commit 530cffc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions inc/fdb_low_lvl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
/* Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4)
* 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 */
#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)
* would return 12.
Expand Down
4 changes: 1 addition & 3 deletions src/fdb_kvdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,8 +1597,7 @@ static fdb_err_t _fdb_kv_load(fdb_kvdb_t db)
/* check all sector header */
sector_iterator(db, &sector, FDB_SECTOR_STORE_UNUSED, &check_failed_count, db, check_sec_hdr_cb, false);
if (db->parent.not_formatable && check_failed_count > 0) {
result = FDB_READ_ERR;
goto __exit;
return FDB_READ_ERR;
}
/* all sector header check failed */
if (check_failed_count == SECTOR_NUM) {
Expand All @@ -1621,7 +1620,6 @@ static fdb_err_t _fdb_kv_load(fdb_kvdb_t db)

db->in_recovery_check = false;

__exit:
/* unlock the KV cache */
db_unlock(db);

Expand Down

0 comments on commit 530cffc

Please sign in to comment.