Skip to content

f_cache: possibly redundant? #14

@JordanYates

Description

@JordanYates

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions