-
Notifications
You must be signed in to change notification settings - Fork 16
Description
The custom NVS caching implementation in f_cache.c is potentially redundant, as the Zephyr NVS filesystem has built-in caching functionality, CONFIG_NVS_LOOKUP_CACHE.
The caching mechanism makes lookup times linear, instead of needing to walk the linked list.
NVS additionally already performs duplicate data checking to reduce writes:
https://github.com/zephyrproject-rtos/zephyr/blob/f9051d626d7607f1e0e18f5bafd2acb3a199ac12/subsys/fs/nvs/nvs.c#L1078-L1083
A major advantage of using the built-in caching is that there is no need to buffer entries in RAM, as the cache contains a pointer directly to the allocated address in the NVS filesystem.
This is just a suggestion, as I can't know if there is additional de-duplication occurring inside libstorage.a based on the _b_dirty field.