mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-02 07:09:33 +01:00
components/nvs: batch writes when possible
Introduces new internal function, Page::alterEntryRangeState, which gathers changes to multiple elements of entry state table into a single write, provided that these changes fall into a single word. This allows changing state of up to 16 entries in a single write. Also adds new function, writeEntryData, which writes the whole payload of SZ and BLOB type entries in one go, instead of splitting it into multiple 32-byte writes. This reduces number of writes required for SZ and BLOB entries.
This commit is contained in:
@@ -234,6 +234,7 @@ void Storage::debugCheck()
|
||||
|
||||
for (auto p = mPageManager.begin(); p != mPageManager.end(); ++p) {
|
||||
size_t itemIndex = 0;
|
||||
size_t usedCount = 0;
|
||||
Item item;
|
||||
while (p->findItem(Page::NS_ANY, ItemType::ANY, nullptr, itemIndex, item) == ESP_OK) {
|
||||
std::stringstream keyrepr;
|
||||
@@ -246,7 +247,9 @@ void Storage::debugCheck()
|
||||
}
|
||||
keys.insert(std::make_pair(keystr, static_cast<Page*>(p)));
|
||||
itemIndex += item.span;
|
||||
usedCount += item.span;
|
||||
}
|
||||
assert(usedCount == p->getUsedEntryCount());
|
||||
}
|
||||
}
|
||||
#endif //ESP_PLATFORM
|
||||
|
||||
Reference in New Issue
Block a user