mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-03 19:49:09 +08:00
fis(nvs_flash): Fix recovery after power-off during erase operation
Current code for recovery after power-off do not clean-up partially erased items for FULL pages. If the erasure was part of modification operation, this gets luckily cleaned-up because of duplicate detection logic. For erase-only operation, the problem still exists. This patch adds the recovery for FULL pages also. esp-idf commit ID: 9a3c4b71
This commit is contained in:
@ -594,6 +594,16 @@ esp_err_t Page::mLoadEntryTable()
|
||||
assert(item.span > 0);
|
||||
|
||||
size_t span = item.span;
|
||||
|
||||
if (item.datatype == ItemType::BLOB || item.datatype == ItemType::SZ) {
|
||||
for (size_t j = i + 1; j < i + span; ++j) {
|
||||
if (mEntryTable.get(j) != EntryState::WRITTEN) {
|
||||
eraseEntryAndSpan(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i += span - 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user