Skip to content

Commit ae7c620

Browse files
author
Kyle Kearney
committed
kv_config: Remove hard fail on too few pages
STORE_SECTORS is a hard requirement. If there are fewer than 2 pages then the kvstore will not work, because the garbage collection process relies on having at least two sectors to work with. STORE_PAGES is a heuristic. It is a reasonable default to use if the application does not specify the amount of flash to use for TDBStore. But if an application knows that a smaller number of pages will suffice for its specific needs, then that is valid and should be permitted.
1 parent 7f18a6c commit ae7c620

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

features/storage/kvstore/conf/kv_config.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,6 @@ int _calculate_blocksize_match_tdbstore(BlockDevice *bd)
194194
return -1;
195195
}
196196

197-
if (number_of_page < STORE_PAGES) {
198-
tr_error("KV Config: There are less than %d pages - TDBStore will not work.", STORE_PAGES);
199-
return -1;
200-
}
201-
202-
203197
if (number_of_sector % 2 != 0) {
204198
tr_warning("KV Config: Number of sectors is not an even number. Consider changing the BlockDevice size");
205199
}
@@ -600,7 +594,7 @@ int _create_internal_tdb(BlockDevice **internal_bd, KVStore **internal_tdb, bd_s
600594

601595
//Check if TDBStore has at least 2 sectors or 14 pages.
602596
if (_calculate_blocksize_match_tdbstore(*internal_bd) != MBED_SUCCESS) {
603-
tr_error("KV Config: Can not create TDBStore with less then %d sectors or %d pages.", STORE_SECTORS, STORE_PAGES);
597+
tr_error("KV Config: Can not create TDBStore with less then %d sectors.", STORE_SECTORS);
604598
return MBED_ERROR_INVALID_ARGUMENT;
605599
}
606600

0 commit comments

Comments
 (0)