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:
daishengdong
2019-12-20 11:20:30 +08:00
parent febcf10911
commit c4c60c3722

View File

@@ -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. // no more fresh block, cannot allocate new block and cannot do gc neither.
if (KV_MGR_BLK_NUM_FRESH < 1) { if (KV_MGR_BLK_NUM_FRESH < 1) {
KV_MGR_WORKSPACE = KV_BLK_INVALID; return KV_BLK_INVALID;
return KV_MGR_WORKSPACE;
} }
// if we have more than one fresh block, just give it out // if we have more than one fresh block, just give it out