Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lfs_fs_gc to enable proactive finding of free blocks #875

Merged
merged 5 commits into from
Sep 21, 2023
Merged

Add lfs_fs_gc to enable proactive finding of free blocks #875

merged 5 commits into from
Sep 21, 2023

Conversation

geky
Copy link
Member

@geky geky commented Sep 18, 2023

See #610 for more info, original PR by @opilat.

This API allows users to run the internal block allocator directly, which may allow users to move the expensive block scan out of performance sensitive parts of their codebase.

It should be noted this API does not current persist the results of the block scan on disk, so calling lfs_fs_gc and then remounting does nothing. This may change in the future.

@geky-bot
Copy link
Collaborator

Tests passed ✓, Code: 16710 B (+0.2%), Stack: 1448 B (+1.1%), Structs: 788 B (+0.0%)
Code Stack Structs Coverage
Default 16710 B (+0.2%) 1448 B (+1.1%) 788 B (+0.0%) Lines 2327/2507 lines (+0.0%)
Readonly 6126 B (+0.0%) 448 B (+0.0%) 788 B (+0.0%) Branches 1186/1508 branches (-0.0%)
Threadsafe 17562 B (+0.3%) 1448 B (+1.1%) 796 B (+0.0%) Benchmarks
Multiversion 16786 B (+0.2%) 1448 B (+1.1%) 792 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18394 B (+0.2%) 1752 B (+0.9%) 792 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17342 B (+0.2%) 1440 B (+1.1%) 788 B (+0.0%) Erased 1568888832 B (+0.0%)

ondrapCZE and others added 5 commits September 21, 2023 12:18
…esn't exist move it for whole lookahead size.
This adds the tracing and optional locking for the littlefs API.

Also updated to match the code style, and added LFS_READONLY guards
where necessary.
- Test that the code actually runs.

- Test that lfs_fs_findfreeblocks does not break block allocations.

- Test that lfs_fs_findfreeblocks does not error when no space is
  available, it should only errors when the block is actually needed.
The idea is in the future this function may be extended to support other
block janitorial work. In such a case calling this lfs_fs_gc provides a
more general name that can include other operations.

This is currently just wishful thinking, however.
@geky-bot
Copy link
Collaborator

Tests passed ✓, Code: 16838 B (+0.2%), Stack: 1448 B (+1.1%), Structs: 800 B (+0.0%)
Code Stack Structs Coverage
Default 16838 B (+0.2%) 1448 B (+1.1%) 800 B (+0.0%) Lines 2357/2533 lines (+0.1%)
Readonly 6130 B (+0.0%) 448 B (+0.0%) 800 B (+0.0%) Branches 1202/1528 branches (+0.1%)
Threadsafe 17722 B (+0.3%) 1448 B (+1.1%) 808 B (+0.0%) Benchmarks
Multiversion 16898 B (+0.2%) 1448 B (+1.1%) 804 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18514 B (+0.2%) 1752 B (+0.9%) 804 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17498 B (+0.2%) 1440 B (+1.1%) 800 B (+0.0%) Erased 1568888832 B (+0.0%)

@geky geky merged commit 0eb52a2 into devel Sep 21, 2023
32 checks passed
@geky geky mentioned this pull request Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants