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

FWFS Mountpoint Support #2315

Merged
merged 5 commits into from
Apr 25, 2021
Merged

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Apr 23, 2021

Remove object stores

LittleFS is an excellent choice for flexible metadata handling, making further development of FWFS writeable object stores a rather pointless excercise. This PR reverts FWFS back to pre-object store model which is faster and simpler. This is largely an internal change and does not affect applications, but does simplify operation considerably as the filing system is now just mounted directly on a partition.

Mountpoint support

Images can be built with nominated directories as mount-points. Instead of object stores, filesystems (LittleFS, SPIFFS, etc) can be mounted there instead using the new IFileSystem::setVolume method. See Basic_IFS sample for a demonstration of how this works.

Remove object alignment

This is a Breaking change and will require existing applications to rebuild their FWFS images.

FWFS started life as a binary image linked into the firmware (IMPORT_FSTR) so benefitted from having object headers word-aligned. This was fast but inflexible, and with a partition-based system alignment is not necessary so the code can be simplified by removing this. It also saves a little space which could be significant for large numbers of small files, or files with large numbers of small attributes.

Fixes

Volume ID missing from returned FWFS filesystem information.

LittleFS stat information sometimes a bit weird because structure initialisation not performed.

Additional parameter checking to avoid exceptions calling filesystem functions if not mounted.

Additional checks on paths, use general isRootPath() function.

Fail FWFS file open requests with write access

Other changes

Add FWFS_CACHE_SPACING build variable to balance RAM usage vs. lookup speed.

Allocate opendir descriptors on heap instead of consuming a regular file handle. This allows recursive directory enumeration without running out of handles.

Add performance module to test application to help evaluate filesystems.

Only generate MD5 Hash attributes for files. Previously directories were included, which is not necessary.

Improve FWFS performance by caching root directory.

mikee47 added 4 commits April 23, 2021 17:28
Remove object stores, simplify code
Support mounting filesystem instead of object store
Don't align filesystem images (simplification)
@mikee47 mikee47 changed the title FWFS optimsations and improvements FWFS optimisations and improvements Apr 23, 2021
@mikee47 mikee47 changed the title FWFS optimisations and improvements FWFS Mountpoint Support Apr 23, 2021
@mikee47 mikee47 changed the title FWFS Mountpoint Support [WIP] FWFS Mountpoint Support Apr 24, 2021
@mikee47 mikee47 force-pushed the feature/fwfs-mountpoints branch from 188f125 to 540539b Compare April 24, 2021 16:14
@mikee47 mikee47 changed the title [WIP] FWFS Mountpoint Support FWFS Mountpoint Support Apr 24, 2021
@slaff slaff added this to the 4.3.1 milestone Apr 24, 2021
@mikee47 mikee47 force-pushed the feature/fwfs-mountpoints branch 2 times, most recently from 092e52c to 9f548ca Compare April 24, 2021 20:06
@mikee47 mikee47 force-pushed the feature/fwfs-mountpoints branch 2 times, most recently from 9c2d1c8 to 09bd1ba Compare April 24, 2021 21:23
@slaff slaff merged commit 40e22c3 into SmingHub:develop Apr 25, 2021
@slaff slaff removed the 3 - Review label Apr 25, 2021
slaff pushed a commit that referenced this pull request Apr 29, 2021
This PR simplifies FWFS further by storing object identifiers as image offsets. Advantages:

- No cache required
- Faster because we can jump directly to the referenced record
- Debugging and introspection is much easier

The references are stored as packed integers (1 - 4 bytes).

Note: Existing images need to be rebuilt. This change should have been included in #2315 as the use of numeric object IDs was part of the abstraction for object stores.
@mikee47 mikee47 deleted the feature/fwfs-mountpoints branch May 3, 2021 11:18
@slaff slaff mentioned this pull request May 5, 2021
5 tasks
slaff pushed a commit that referenced this pull request Sep 27, 2021
**Remove object stores**

LittleFS is an excellent choice for flexible metadata handling, making further development of FWFS writeable object stores a rather pointless excercise. This PR reverts FWFS back to pre-object store model which is faster and simpler. This is largely an internal change and does not affect applications, but does simplify operation considerably as the filing system is now just mounted directly on a partition.

**Mountpoint support**

Images can be built with nominated directories as mount-points. Instead of object stores, filesystems (LittleFS, SPIFFS, etc) can be mounted there instead using the new `IFileSystem::setVolume` method. See `Basic_IFS` sample for a demonstration of how this works.

**Remove object alignment**

This is a **Breaking change** and will require existing applications to rebuild their FWFS images.

FWFS started life as a binary image linked into the firmware (IMPORT_FSTR) so benefitted from having object headers word-aligned. This was fast but inflexible, and with a partition-based system alignment is not necessary so the code can be simplified by removing this. It also saves a little space which could be significant for large numbers of small files, or files with large numbers of small attributes.

**Fixes**

Volume ID missing from returned FWFS filesystem information.

LittleFS `stat` information sometimes a bit weird because structure initialisation not performed.

Additional parameter checking to avoid exceptions calling filesystem functions if not mounted.

Additional checks on paths, use general `isRootPath()` function.

Fail FWFS file open requests with write access

**Other changes**

Add `FWFS_CACHE_SPACING` build variable to balance RAM usage vs. lookup speed.

Allocate `opendir` descriptors on heap instead of consuming a regular file handle. This allows recursive directory enumeration without running out of handles.

Add performance module to test application to help evaluate filesystems.

Only generate MD5 Hash attributes for files. Previously directories were included, which is not necessary.

Improve FWFS performance by caching root directory.
slaff pushed a commit that referenced this pull request Sep 27, 2021
This PR simplifies FWFS further by storing object identifiers as image offsets. Advantages:

- No cache required
- Faster because we can jump directly to the referenced record
- Debugging and introspection is much easier

The references are stored as packed integers (1 - 4 bytes).

Note: Existing images need to be rebuilt. This change should have been included in #2315 as the use of numeric object IDs was part of the abstraction for object stores.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants