fix a bug
consider this situation: no more fresh block, meantime an item with such a big size come in, and currently no block inuse has sufficient space to save this item, the code will run into the modified line, and KV_MGR_WORKSPACE will be set to KV_BLK_INVALID. this will cause no matter what size of an item wanna come in again, kv_blk_search_suitable just return KV_BLK_INVALID because "if (KV_MGR_WORKSPACE == KV_BLK_INVALID)" is true.
This commit is contained in:
@@ -188,8 +188,7 @@ __STATIC__ uint32_t kv_blk_search_suitable(uint32_t item_size)
|
||||
|
||||
// no more fresh block, cannot allocate new block and cannot do gc neither.
|
||||
if (KV_MGR_BLK_NUM_FRESH < 1) {
|
||||
KV_MGR_WORKSPACE = KV_BLK_INVALID;
|
||||
return KV_MGR_WORKSPACE;
|
||||
return KV_BLK_INVALID;
|
||||
}
|
||||
|
||||
// if we have more than one fresh block, just give it out
|
||||
|
Reference in New Issue
Block a user