TDBStore: optimize erase algorithms
Currently `TDBStore::offset_in_erase_unit()` and
`TDBStore::check_erase_before_write()` loop through erase units
one-by-one, until the entire range is covered. This is very inefficient
when the erase size is tiny, e.g. one-byte on a non-flash device for
which we use program as erase.

This commit reworks the algorithms, based on the fact that a block
device can erase or program as many units as needed in one go.
ls
1 parent e807051 commit fb4e5e80b4fea02418b7cb52b98798552d535753
@Lingkai Dong Lingkai Dong authored on 31 Mar 2021
Showing 2 changed files
View
storage/kvstore/tdbstore/include/tdbstore/TDBStore.h
View
storage/kvstore/tdbstore/source/TDBStore.cpp