forked from Imagelibrary/littlefs
Merge pull request #1110 from Ryan-CW-Code/perf_gc
perf: gc might try to populate the lookahead buffer each time
This commit is contained in:
4
lfs.c
4
lfs.c
@@ -5222,7 +5222,9 @@ static int lfs_fs_gc_(lfs_t *lfs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try to populate the lookahead buffer, unless it's already full
|
// try to populate the lookahead buffer, unless it's already full
|
||||||
if (lfs->lookahead.size < 8*lfs->cfg->lookahead_size) {
|
if (lfs->lookahead.size < lfs_min(
|
||||||
|
8 * lfs->cfg->lookahead_size,
|
||||||
|
lfs->block_count)) {
|
||||||
err = lfs_alloc_scan(lfs);
|
err = lfs_alloc_scan(lfs);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user