diff options
| author | Peter Züger <zueger.peter@icloud.com> | 2023-12-21 00:17:15 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-12-22 11:03:23 +1100 |
| commit | ce42c9ee1659ff86337a7f528332b4eaed6df0fc (patch) | |
| tree | 309cdeb6a27eb1589c1f932b5394ebc6b28e3999 /extmod/vfs_lfsx.c | |
| parent | 3bca93b2d00dec37b3770c3e4fac15f07e0b9f15 (diff) | |
extmod/vfs_lfs: Fix lfs cache_size calculation.
The calculation of the lfs2 cache_size was incorrect, the maximum allowed
size is block_size.
The cache size must be: "a multiple of the read and program sizes, and a
factor of the block size".
Signed-off-by: Peter Züger <zueger.peter@icloud.com>
Diffstat (limited to 'extmod/vfs_lfsx.c')
| -rw-r--r-- | extmod/vfs_lfsx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/vfs_lfsx.c b/extmod/vfs_lfsx.c index fe0731ece..e78c154d1 100644 --- a/extmod/vfs_lfsx.c +++ b/extmod/vfs_lfsx.c @@ -99,7 +99,7 @@ STATIC void MP_VFS_LFSx(init_config)(MP_OBJ_VFS_LFSx * self, mp_obj_t bdev, size config->lookahead_buffer = m_new(uint8_t, config->lookahead / 8); #else config->block_cycles = 100; - config->cache_size = 4 * MAX(read_size, prog_size); + config->cache_size = MIN(config->block_size, (4 * MAX(read_size, prog_size))); config->lookahead_size = lookahead; config->read_buffer = m_new(uint8_t, config->cache_size); config->prog_buffer = m_new(uint8_t, config->cache_size); |
