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

Do we really need directory structures in meta data layer for simple structure variable read/write? #970

Open
msswamy11 opened this issue Apr 20, 2024 · 1 comment

Comments

@msswamy11
Copy link

msswamy11 commented Apr 20, 2024

Hello,
I am planning to use this LittleFS to my microcontroller project, my requirement is very simple as read and write some data structures in C language,
lfs_file_read(&lfs, &file, &boot_count, sizeof(boot_count));
lfs_file_write(&lfs, &file, &boot_count, sizeof(boot_count));

I have integrated LFS into my project and found more time for write operations on my 35MHZ clock.
For init around 1.7ms
For write around 4.7ms it was taking.

Then started digging into code, observed so many directory related operations even though it was not required for simple variable read/write.

Please provide some suggestions how to make it very fast?
Any other way to use this framework without directory structure for simple variable writes, to make it faster?

@geky
Copy link
Member

geky commented Apr 29, 2024

Hi @msswamy11,

There are a number of known issues with performance in littlefs, such as #783. These are being worked on, but require significant changes. It may be useful to read through other issues, but the information is a bit scattered.

Then started digging into code, observed so many directory related operations even though it was not required for simple variable read/write.

This is a bit of a red-herring. Files can't not exist in a directory, by default they just exist in the root directory.

In littlefs, the internal lfs_dir_* functions handle anything related to file metadata, including simple file updates. Unfortunately, updating metadata gets quite complicated when you need to also handle power-loss and flash's limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants