txg: generalise txg_wait_synced_sig()
to txg_wait_synced_flags()
#17284
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
We have work in progress that will require breaking out of a
txg_wait_synced()
call in some situations. These are still in development, and may change, but are:fsync()
return error when the pool suspends,txg_wait_synced()
needs to return when the pool suspendstxg_wait_synced()
.This is the supporting API change to allow these kind of things to be added in the future.
Description
txg_wait_synced_sig()
is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour.This generalises the API as
txg_wait_synced_flags()
, where the provided flags describe the events that should cause the call to return.Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return.
The existing call to
txg_wait_synced_sig()
is nowtxg_wait_synced_flags(TXG_WAIT_SIGNAL)
.How Has This Been Tested?
Compile checked on Linux and FreeBSD. Basic sanity checks done.
(Tested a lot on internal projects too).
Types of changes
Checklist:
Signed-off-by
.