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:
Dong Heng
2019-01-22 11:30:05 +08:00
parent 46118bdf2f
commit 174ada55a2

View File

@ -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;
}