mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
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:
@@ -86,12 +86,19 @@ top:
|
||||
|
||||
dmu_tx_commit(tx);
|
||||
|
||||
if (sigfunc != NULL && txg_wait_synced_sig(dp, dst.dst_txg)) {
|
||||
/* current contract is to call func once */
|
||||
sigfunc(arg, tx);
|
||||
sigfunc = NULL; /* in case we're performing an EAGAIN retry */
|
||||
}
|
||||
txg_wait_synced(dp, dst.dst_txg);
|
||||
if (sigfunc != NULL) {
|
||||
err = txg_wait_synced_flags(dp, dst.dst_txg, TXG_WAIT_SIGNAL);
|
||||
if (err != 0) {
|
||||
VERIFY3U(err, ==, EINTR);
|
||||
/* current contract is to call func once */
|
||||
sigfunc(arg, tx);
|
||||
/* in case we're performing an EAGAIN retry */
|
||||
sigfunc = NULL;
|
||||
|
||||
txg_wait_synced(dp, dst.dst_txg);
|
||||
}
|
||||
} else
|
||||
txg_wait_synced(dp, dst.dst_txg);
|
||||
|
||||
if (dst.dst_error == EAGAIN) {
|
||||
txg_wait_synced(dp, dst.dst_txg + TXG_DEFER_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user