-
Notifications
You must be signed in to change notification settings - Fork 27
samples: subsys: fs: bm_zms: add wait after clear #490
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
base: main
Are you sure you want to change the base?
Conversation
|
You can find the documentation preview for this PR here. |
e55e8c4 to
a73dfb8
Compare
a73dfb8 to
b9a5b6f
Compare
b9a5b6f to
f446ab9
Compare
doc/nrf-bm/libraries/bm_zms.rst
Outdated
| Clearing the storage system | ||
| =========================== | ||
|
|
||
| The :c:func:`bm_zms_clear` function must be called to clear the storage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The :c:func:`bm_zms_clear` function must be called to clear the storage. | |
| Call the :c:func:`bm_zms_clear` function to clear the storage. |
doc/nrf-bm/libraries/bm_zms.rst
Outdated
| The :c:func:`bm_zms_clear` function must be called to clear the storage. | ||
|
|
||
| When this uninitialization is successful, the library sets the flag :c:member:`bm_zms_fs.init_flags.initialized` to false. | ||
| For asynchronous storage backends, you must wait for the uninitialization to finish before re-initializing the storage system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| For asynchronous storage backends, you must wait for the uninitialization to finish before re-initializing the storage system. | |
| For asynchronous storage backends, you must wait for the uninitialization to finish before reinitializing the storage system. |
f446ab9 to
bac73f5
Compare
doc/nrf-bm/libraries/bm_zms.rst
Outdated
| Clearing the storage system | ||
| =========================== | ||
|
|
||
| Call the :c:func:`bm_zms_clear` function to clear the storage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps state explicitly here that it uinintializes the zms instance.
| Call the :c:func:`bm_zms_clear` function to clear the storage. | |
| Call the :c:func:`bm_zms_clear` function to clear the storage and uninitialize the ZMS instance. |
|
bac73f5 to
d0affad
Compare
The `bm_zms_clear` function executes write operations under the hood that can be asynchronous. The condition of termination for the operation is when the file system is set to uninitialized. Adds a check for this condition before terminating the sample. Signed-off-by: Mirko Covizzi <mirko.covizzi@nordicsemi.no>
Adds section that explains how to handle the storage system clear. Signed-off-by: Mirko Covizzi <mirko.covizzi@nordicsemi.no>
d0affad to
decc84c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something's wrong here; it cannot be that un-initialization should be checked by the application by polling an internal flag in the instance structure-- this whole library has an asynchronous interface and the uninitialization should be signalled by an event. If un-initialization hasn't completed at the time the event is sent, then it's a bug but clearly we can't solve it like this.
I agree, that requires a bit of a redesign of the ZMS API and logic. Currently, the subsystem is operating on flags when it comes to specific actions. My contribution is simply addressing the current existing implementation and how it lacks adequate documentation for its behavior. @rghaddab Any opinions on this topic? |
|
Can you try to explain exactly what the problem is? |
Currently the problem is that we are not documenting to the user how to make sure that a clear has completed. I'm currently looking into the event system, and while there is an event for CLEAR, it is never propagated because as I just discovered, we are effectively resetting the handlers to NULL on CLEAR, before sending the event. That, instead, is a bug. |
Yes, I fully agree with that. It's a bug, the |
Yes, that's what I planned to do too. I'm working on a PR that addresses this behavior. |



The
bm_zms_clearfunction executes write operations under the hood that can be asynchronous.The condition of termination for the operation is when the file system is set to uninitialized.
Adds a check for this condition before terminating the sample.