Skip to content
Commit 8ea2956c authored by Peter Bigot's avatar Peter Bigot Committed by Anas Nashif
Browse files

fs: littlefs: revise how per-file cache memory is allocated



Originally the file cache used a mem_pool, but that data structure has
been deprecated and replaced by a heap that includes metadata in the
heap area.  As a result attempts to allocate all blocks will fail
because some of the reservation intended for cache data is now holding
metadata instead.

It's not immediately clear how to adjust the required heap size to
support this metadata as it depends on heap chunk units and data
structures that are not visible to the application.  Experimentally a
value of 24 bytes works, while smaller values do not.

Further the previous Kconfig API to configure the allocation pool is
completely inappropriate with the new heap data structure which has
such different behavior.

So: Deprecate the old Kconfig API.  Add a new Kconfig option to
directly control the cache size.  Infer a default cache size that
works with the old mem_pool parameters assuming a per-block overhead.
But to avoid wasted memory use the heap allocation only when the
application customizes the size, and use a slab in other cases.

Signed-off-by: default avatarPeter Bigot <peter.bigot@nordicsemi.no>
parent 1ee82a1c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment