txg: generalise txg_wait_synced_sig() to txg_wait_synced_flags() (#17284)

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 now
txg_wait_synced_flags(TXG_WAIT_SIGNAL).

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.

Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
This commit is contained in:
Rob Norris
2025-05-03 08:29:50 +10:00
committed by GitHub
parent f85c96edf7
commit a7de203c86
4 changed files with 52 additions and 28 deletions
+2 -2
View File
@@ -970,8 +970,8 @@ zcp_pool_error(zcp_run_info_t *ri, const char *poolname, int error)
}
/*
* This callback is called when txg_wait_synced_sig encountered a signal.
* The txg_wait_synced_sig will continue to wait for the txg to complete
* This callback is called when txg_wait_synced_flags encountered a signal.
* The txg_wait_synced_flags will continue to wait for the txg to complete
* after calling this callback.
*/
static void