mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 00:38:29 +01:00
Merge pull request #160 from FreddieChopin/no-cache-bypass
Don't bypass cache in `lfs_cache_prog()` and `lfs_cache_read()`
This commit is contained in:
15
lfs.c
15
lfs.c
@@ -80,21 +80,6 @@ static int lfs_bd_read(lfs_t *lfs,
|
|||||||
diff = lfs_min(diff, rcache->off-off);
|
diff = lfs_min(diff, rcache->off-off);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size >= hint && off % lfs->cfg->read_size == 0 &&
|
|
||||||
size >= lfs->cfg->read_size) {
|
|
||||||
// bypass cache?
|
|
||||||
diff = lfs_aligndown(diff, lfs->cfg->read_size);
|
|
||||||
int err = lfs->cfg->read(lfs->cfg, block, off, data, diff);
|
|
||||||
if (err) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
data += diff;
|
|
||||||
off += diff;
|
|
||||||
size -= diff;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load to cache, first condition can no longer fail
|
// load to cache, first condition can no longer fail
|
||||||
LFS_ASSERT(block < lfs->cfg->block_count);
|
LFS_ASSERT(block < lfs->cfg->block_count);
|
||||||
rcache->block = block;
|
rcache->block = block;
|
||||||
|
|||||||
Reference in New Issue
Block a user