fs: littlefs: Fix lookahead buffer sizing
The lookahead buffer is a bitmap containing info on free blocks and does not have a minimum size or an alignment requirement. This fixes the arbitrary 4 * block_size requirement for block devices and fixes Kconfig documentation to remove a reference to nonexistent 8 byte alignment requirement. Signed-off-by: Djordje Nedic <nedic.djordje2@gmail.com>
This commit is contained in:
parent
2a206a07b3
commit
30bac038fa
@ -56,8 +56,7 @@ config FS_LITTLEFS_LOOKAHEAD_SIZE
|
||||
help
|
||||
A larger lookahead buffer increases the number of blocks found
|
||||
during an allocation pass. The lookahead buffer is stored as a
|
||||
compact bitmap, so each byte of RAM can track 8 blocks. Must
|
||||
be a multiple of 8.
|
||||
compact bitmap, so each byte of RAM can track 8 blocks.
|
||||
|
||||
config FS_LITTLEFS_BLOCK_CYCLES
|
||||
int "Number of erase cycles before moving data to another block"
|
||||
|
||||
@ -844,8 +844,6 @@ static int littlefs_init_cfg(struct fs_littlefs *fs, int flags)
|
||||
lcp->context = fs->backend;
|
||||
/* Set the validated/defaulted values. */
|
||||
if (littlefs_on_blkdev(flags)) {
|
||||
lfs_size_t new_lookahead_size = block_size * 4;
|
||||
|
||||
lcp->read = lfs_api_read_blk;
|
||||
lcp->prog = lfs_api_prog_blk;
|
||||
lcp->erase = lfs_api_erase_blk;
|
||||
@ -859,12 +857,7 @@ static int littlefs_init_cfg(struct fs_littlefs *fs, int flags)
|
||||
}
|
||||
lcp->cache_size = ROUND_DOWN(cache_size, block_size);
|
||||
|
||||
if (lookahead_size < new_lookahead_size) {
|
||||
LOG_ERR("Configured lookahead size is too small: %d < %d",
|
||||
lookahead_size, new_lookahead_size);
|
||||
return -ENOMEM;
|
||||
}
|
||||
lcp->lookahead_size = new_lookahead_size;
|
||||
lcp->lookahead_size = lookahead_size;
|
||||
|
||||
lcp->sync = lfs_api_sync_blk;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user