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

Introduce AFATFS_ASYNC_IO #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Risca
Copy link

@Risca Risca commented Jun 18, 2021

This change introduces a new feature which enables afatfs_poll() to become an internal static function, and everything else works (almost) as before. The one difference is that callbacks may be called directly from the routine where it was provided, even before the routine returns. E.g. the callback for "unlink complete" may be called before afatfs_funlink() returns.

The feature can be enabled by compiling AsyncFatFS with "AFATFS_ASYNC_IO" defined.

@thenickdude
Copy link
Owner

My concern with this approach is that if the sdcard read/write primitives are implemented synchronously (i.e. they call the completion callback before returning), this will cause asyncfatfs to re-enter afatfs_poll(). This will lead to it performing an unbounded amount of work (particularly at card init when writing the freefile) and using an unbounded amount of stacksize, neither of which can be tolerated.

Synchronous read/write SD card primitives are a common choice when DMA is not available.

@Risca
Copy link
Author

Risca commented Jun 19, 2021

My concern with this approach is that if the sdcard read/write primitives are implemented synchronously (i.e. they call the completion callback before returning), this will cause asyncfatfs to re-enter afatfs_poll(). This will lead to it performing an unbounded amount of work (particularly at card init when writing the freefile) and using an unbounded amount of stacksize, neither of which can be tolerated.

Synchronous read/write SD card primitives are a common choice when DMA is not available.

Yes, I understand your concern. I had some thoughts about putting ifdefs around these changes, since they are rather experimental, and add some major disclaimers

@Risca Risca force-pushed the no_poll branch 2 times, most recently from 0604ce0 to 55a20a9 Compare June 23, 2021 21:08
@Risca Risca changed the title make it even more asynchronous Introduce AFATFS_ASYNC_IO Jun 23, 2021
@Risca
Copy link
Author

Risca commented Jun 23, 2021

I reworked the changes so the feature can be enabled at compile time, and also updated the readme file 😺

@thenickdude, do you think this feature is useful for AsyncFS?

Risca added 2 commits June 23, 2021 23:18
This change introduces a new feature which enables afatfs_poll() to
become an internal static function, and everything else works (almost)
as before. The one difference is that callbacks may be called directly
from the routine where it was provided, even before the routine returns.
E.g. the callback for "unlink complete" may be called before
afatfs_funlink() returns.

The feature can be enabled by compiling AsyncFatFS with AFATFS_ASYNC_IO
defined.
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