zephyr/subsys/fs/nvs/Kconfig
Damian Krolik 74e4ac0883 nvs: implement NVS cache
The NVS data lookup time grows linearly with the number of
allocation table entries to walk through, meaning that if
some data pair in the NVS changes frequently, access to
other data pairs that change rarely can take a lot of time.

It is particularly visible when the NVS is used as the
settings backend since the backend needs to perform multiple
NVS reads to find a requested key.

Implement a simple cache that stores an address of the most
recent ATE for all NVS IDs that fall into the given cache
position. CRC8/16 is used as a hash function used to
distribute NVS IDs across the cache entries.

The cache entries are only invalidated when an NVS sector
is erased as part of the garbage collector task.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2022-06-05 14:43:59 +02:00

34 lines
824 B
Plaintext

# Non-volatile Storage NVS
# Copyright (c) 2018 Laczen
# SPDX-License-Identifier: Apache-2.0
config NVS
bool "Non-volatile Storage"
help
Enable support of Non-volatile Storage.
if NVS
config NVS_LOOKUP_CACHE
bool "Non-volatile Storage lookup cache"
help
Enable Non-volatile Storage cache, used to reduce the NVS data lookup
time. Each cache entry holds an address of the most recent allocation
table entry (ATE) for all NVS IDs that fall into that cache position.
config NVS_LOOKUP_CACHE_SIZE
int "Non-volatile Storage lookup cache size"
default 128
range 1 65536
depends on NVS_LOOKUP_CACHE
help
Number of entries in Non-volatile Storage lookup cache.
It is recommended that it be a power of 2.
module = NVS
module-str = nvs
source "subsys/logging/Kconfig.template.log_config"
endif # NVS