MCPcopy Create free account
hub / github.com/F-Stack/f-stack / txg_wait_synced_impl

Function txg_wait_synced_impl

freebsd/contrib/openzfs/module/zfs/txg.c:672–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672static boolean_t
673txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig)
674{
675 tx_state_t *tx = &dp->dp_tx;
676
677 ASSERT(!dsl_pool_config_held(dp));
678
679 mutex_enter(&tx->tx_sync_lock);
680 ASSERT3U(tx->tx_threads, ==, 2);
681 if (txg == 0)
682 txg = tx->tx_open_txg + TXG_DEFER_SIZE;
683 if (tx->tx_sync_txg_waiting < txg)
684 tx->tx_sync_txg_waiting = txg;
685 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
686 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
687 while (tx->tx_synced_txg < txg) {
688 dprintf("broadcasting sync more "
689 "tx_synced=%llu waiting=%llu dp=%px\n",
690 tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp);
691 cv_broadcast(&tx->tx_sync_more_cv);
692 if (wait_sig) {
693 /*
694 * Condition wait here but stop if the thread receives a
695 * signal. The caller may call txg_wait_synced*() again
696 * to resume waiting for this txg.
697 */
698 if (cv_wait_io_sig(&tx->tx_sync_done_cv,
699 &tx->tx_sync_lock) == 0) {
700 mutex_exit(&tx->tx_sync_lock);
701 return (B_TRUE);
702 }
703 } else {
704 cv_wait_io(&tx->tx_sync_done_cv, &tx->tx_sync_lock);
705 }
706 }
707 mutex_exit(&tx->tx_sync_lock);
708 return (B_FALSE);
709}
710
711void
712txg_wait_synced(dsl_pool_t *dp, uint64_t txg)

Callers 2

txg_wait_syncedFunction · 0.85
txg_wait_synced_sigFunction · 0.85

Calls 4

dsl_pool_config_heldFunction · 0.85
mutex_enterFunction · 0.85
cv_broadcastFunction · 0.85
mutex_exitFunction · 0.85

Tested by

no test coverage detected