mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 00:38:29 +01:00
Compare commits
2 Commits
config-imp
...
fix-alloc-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8dcf10974 | ||
|
|
d04c1392c0 |
8
lfs.c
8
lfs.c
@@ -1375,8 +1375,12 @@ static int lfs_dir_alloc(lfs_t *lfs, lfs_mdir_t *dir) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// make sure we don't immediately evict
|
||||
dir->rev += dir->rev & 1;
|
||||
// to make sure we don't immediately evict, align the new revision count
|
||||
// to our block_cycles modulus, see lfs_dir_compact for why our modulus
|
||||
// is tweaked this way
|
||||
if (lfs->cfg->block_cycles > 0) {
|
||||
dir->rev = lfs_alignup(dir->rev, ((lfs->cfg->block_cycles+1)|1));
|
||||
}
|
||||
|
||||
// set defaults
|
||||
dir->off = sizeof(dir->rev);
|
||||
|
||||
Reference in New Issue
Block a user