]> granicus.if.org Git - esp-idf/commit
nvs: Fix page selection algo to consider free entry counts as well
authorSagar Bijwe <sagar@espressif.com>
Fri, 13 Apr 2018 09:19:05 +0000 (14:49 +0530)
committerSagar Bijwe <sagar@espressif.com>
Fri, 13 Apr 2018 09:19:05 +0000 (14:49 +0530)
commit7e79471ececad719772dcc721caf8f58b8616aa5
tree17d19061bcb03ee1265491c43634260fb6edb2a3
parentc876ab390b95818eae52e7476eb328c224454724
nvs: Fix page selection algo to consider free entry counts as well

Current page selection algorithm selects a page for compaction based on just erased counts
and gives up when it does not find any page with erased count greater than 0. This is
problematic since the current allocation procedure skips the active page if there is not
enough room for the item in that page leaving free chunks on the pages. This change modifies
the algorithm to consider both erased as well as free counts on the candidate pages.

Closes TW<20297>
components/nvs_flash/src/nvs_pagemanager.cpp
components/nvs_flash/test_nvs_host/test_nvs.cpp