Skip to content

Commit

Permalink
Merge pull request #60 from geky-bot/lfs-v2.8.2
Browse files Browse the repository at this point in the history
Bring in littlefs v2.8.2
  • Loading branch information
geky authored Dec 21, 2023
2 parents c7e2d65 + 6ffcc18 commit 2fd0c1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion littlefs/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
table[$i,$j]=$c_camel
((j+=1))
for s in code stack struct
for s in code stack structs
do
f=sizes/thumb${c:+-$c}.$s.csv
[ -e $f ] && table[$i,$j]=$( \
Expand Down
4 changes: 2 additions & 2 deletions littlefs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This leaves us with three major requirements for an embedded filesystem.
RAM to temporarily store filesystem metadata.

For ROM, this means we need to keep our design simple and reuse code paths
were possible. For RAM we have a stronger requirement, all RAM usage is
where possible. For RAM we have a stronger requirement, all RAM usage is
bounded. This means RAM usage does not grow as the filesystem changes in
size or number of files. This creates a unique challenge as even presumably
simple operations, such as traversing the filesystem, become surprisingly
Expand Down Expand Up @@ -626,7 +626,7 @@ log₂_n_ pointers that skip to different preceding elements of the
skip-list.

The name comes from heavy use of the [CTZ instruction][wikipedia-ctz], which
lets us calculate the power-of-two factors efficiently. For a give block _n_,
lets us calculate the power-of-two factors efficiently. For a given block _n_,
that block contains ctz(_n_)+1 pointers.

```
Expand Down
8 changes: 5 additions & 3 deletions littlefs/lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2fd0c1c

Please sign in to comment.