diff options
author | Christopher Haster <geky@geky.net> | 2023-12-21 09:07:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 09:07:55 +0300 |
commit | 8a22bd6e67288343e9bbe4fa476ec8e75ce9ccf5 (patch) | |
tree | e39c076eeeda09e8624e356949fe7335923f954e | |
parent | 9b82db72d8673c15f8048c4f71bc6c3d9ae5e08c (diff) | |
parent | b9b95ab4bc9479bcd6370e82c55a236325a02026 (diff) |
Merge pull request #910 from littlefs-project/fix-superblock-expansion-thresh
Increase threshold for superblock expansion from ~50% -> ~88% full
-rw-r--r-- | lfs.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -2151,9 +2151,11 @@ static int lfs_dir_splittingcompact(lfs_t *lfs, lfs_mdir_t *dir, return size; } - // do we have extra space? littlefs can't reclaim this space - // by itself, so expand cautiously - if ((lfs_size_t)size < lfs->block_count/2) { + // littlefs cannot reclaim expanded superblocks, so expand cautiously + // + // if our filesystem is more than ~88% full, don't expand, this is + // somewhat arbitrary + if (lfs->block_count - size > lfs->block_count/8) { LFS_DEBUG("Expanding superblock at rev %"PRIu32, dir->rev); int err = lfs_dir_split(lfs, dir, attrs, attrcount, source, begin, end); |