littlefs
littlefs copied to clipboard
Cache sharing
Hi , I have to use 64KB block size and so at least the same size for each cache. If I only need to: -mount
- write a file
- unmount
and t another step
- mount
- read
- unmount
is it possible to share the same static cache for read_cache and write_cache ?
Hi @SadE54, unfortunately no, for write operations littlefs needs both the read_cache and write_cache. This is because writes may involve several intermediate operations for bookkeeping, such as metadata compaction, these operations need to be able to read and write through caches without using the actual file cache.
That being said, you shouldn't need the both caches when only reading files, but this RAM savings hasn't been explored yet even in read-only mode. It would be a good idea for us to improve this.
Also just to clarify, you don't need cache_size == block_size. If you are running into RAM issues you can reduce the cache_size to any multiple of the read_size/prog_size, at a tradeoff of performance.