From c4c60c3722df23a5c6c5a295faaf88959480e391 Mon Sep 17 00:00:00 2001 From: daishengdong Date: Fri, 20 Dec 2019 11:20:30 +0800 Subject: [PATCH] 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. --- components/fs/kv/tos_kv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/fs/kv/tos_kv.c b/components/fs/kv/tos_kv.c index 450173d7..f99e76b1 100644 --- a/components/fs/kv/tos_kv.c +++ b/components/fs/kv/tos_kv.c @@ -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