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: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
1ee82a1c9b
commit
8ea2956ca3
3 changed files with 123 additions and 20 deletions
|
@ -57,7 +57,7 @@ struct fs_littlefs {
|
|||
* values are consistent with littlefs requirements.
|
||||
*
|
||||
* @note If you use a non-default configuration for cache size, you
|
||||
* must also select @option{CONFIG_FS_LITTLEFS_FC_MEM_POOL} to relax
|
||||
* must also select @option{CONFIG_FS_LITTLEFS_FC_HEAP_SIZE} to relax
|
||||
* the size constraints on per-file cache allocations.
|
||||
*
|
||||
* @param name the name for the structure. The defined object has
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue