• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/

Lines Matching refs:txg

42  * these transaction groups. Each successive transaction group (txg) is
45 * there may be an active txg associated with each state; each active txg may
47 * be up to three active txgs, and there is always a txg in the open state
50 * accepted into the txg in the open state, and are completed while the txg is
56 * When a new txg becomes active, it first enters the open state. New
58 * currently open txg. There is always a txg in the open state so that ZFS can
59 * accept new changes (though the txg may refuse new changes if it has hit
60 * some limit). ZFS advances the open txg to the next state for a variety of
66 * After a txg exits the open state, it enters the quiescing state. The
70 * operation without delaying either of the other states. Typically, a txg is
73 * transactions complete, the txg is ready to enter the next state.
100 * datasets. Note that when a synctask is initiated it enters the open txg,
101 * and ZFS then pushes that txg as quickly as possible to completion of the
105 * pool. Finally, if there is a quiesced txg waiting, we signal that it can
112 int zfs_txg_timeout = 5; /* max seconds worth of delta per txg */
115 SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG");
117 "Maximum seconds worth of delta per txg");
120 * Prepare the txg subsystem.
123 txg_init(dsl_pool_t *dp, uint64_t txg)
154 tx->tx_open_txg = txg;
158 * Close down the txg subsystem.
301 uint64_t txg;
304 txg = tx->tx_open_txg;
307 tc->tc_count[txg & TXG_MASK]++;
311 th->th_txg = txg;
313 return (txg);
358 txg_quiesce(dsl_pool_t *dp, uint64_t txg)
361 int g = txg & TXG_MASK;
365 * Grab all tc_open_locks so nobody else can get into this txg.
370 ASSERT(txg == tx->tx_open_txg);
374 DTRACE_PROBE2(txg__quiescing, dsl_pool_t *, dp, uint64_t, txg);
409 * Dispatch the commit callbacks registered on this txg to worker threads.
415 txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg)
425 * only be called once a txg has been synced.
428 int g = txg & TXG_MASK;
492 uint64_t txg;
498 * on us, or the quiesce thread has handed off a txg to
515 * Wait until the quiesce thread hands off a txg to us,
529 * Consume the quiesced txg which has been handed off to
531 * able to quiesce another txg, so we must signal it.
534 txg = tx->tx_quiesced_txg;
536 tx->tx_syncing_txg = txg;
537 DTRACE_PROBE2(txg__syncing, dsl_pool_t *, dp, uint64_t, txg);
540 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
541 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
545 spa_sync(spa, txg);
549 tx->tx_synced_txg = txg;
551 DTRACE_PROBE2(txg__synced, dsl_pool_t *, dp, uint64_t, txg);
557 txg_dispatch_callbacks(dp, txg);
571 uint64_t txg;
575 * However, we can only have one txg in "quiescing" or
577 * the "quiesced, waiting to sync" txg has been consumed
588 txg = tx->tx_open_txg;
589 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
590 txg, tx->tx_quiesce_txg_waiting,
592 tx->tx_quiescing_txg = txg;
595 txg_quiesce(dp, txg);
599 * Hand this txg off to the sync thread.
601 dprintf("quiesce done, handing off txg %llu\n", txg);
603 tx->tx_quiesced_txg = txg;
604 DTRACE_PROBE2(txg__quiesced, dsl_pool_t *, dp, uint64_t, txg);
612 * transaction group and there is already a waiting txg quiesing or quiesced.
613 * Abort the delay if this txg stalls or enters the quiesing state.
616 txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay, hrtime_t resolution)
621 /* don't delay if this txg could transition to quiescing immediately */
622 if (tx->tx_open_txg > txg ||
623 tx->tx_syncing_txg == txg-1 || tx->tx_synced_txg == txg-1)
627 if (tx->tx_open_txg > txg || tx->tx_synced_txg == txg-1) {
633 tx->tx_syncing_txg < txg-1 && !txg_stalled(dp)) {
642 txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig)
650 if (txg == 0)
651 txg = tx->tx_open_txg + TXG_DEFER_SIZE;
652 if (tx->tx_sync_txg_waiting < txg)
653 tx->tx_sync_txg_waiting = txg;
654 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
655 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
656 while (tx->tx_synced_txg < txg) {
665 * to resume waiting for this txg.
693 txg_wait_synced(dsl_pool_t *dp, uint64_t txg)
695 VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE));
703 txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg)
705 return (txg_wait_synced_impl(dp, txg, B_TRUE));
709 txg_wait_open(dsl_pool_t *dp, uint64_t txg)
717 if (txg == 0)
718 txg = tx->tx_open_txg + 1;
719 if (tx->tx_quiesce_txg_waiting < txg)
720 tx->tx_quiesce_txg_waiting = txg;
721 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
722 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
723 while (tx->tx_open_txg < txg) {
731 * If there isn't a txg syncing or in the pipeline, push another txg through
732 * the pipeline by queiscing the open txg.
770 * Verify that this txg is active (open, quiescing, syncing). Non-active
771 * txg's should not be manipulated.
774 txg_verify(spa_t *spa, uint64_t txg)
777 if (txg <= TXG_INITIAL || txg == ZILTEST_TXG)
779 ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg);
780 ASSERT3U(txg, >=, dp->dp_tx.tx_synced_txg);
781 ASSERT3U(txg, >=, dp->dp_tx.tx_open_txg - TXG_CONCURRENT_STATES);
785 * Per-txg object lists.
813 txg_list_empty(txg_list_t *tl, uint64_t txg)
815 txg_verify(tl->tl_spa, txg);
816 return (tl->tl_head[txg & TXG_MASK] == NULL);
820 * Returns true if all txg lists are empty.
842 txg_list_add(txg_list_t *tl, void *p, uint64_t txg)
844 int t = txg & TXG_MASK;
848 txg_verify(tl->tl_spa, txg);
867 txg_list_add_tail(txg_list_t *tl, void *p, uint64_t txg)
869 int t = txg & TXG_MASK;
873 txg_verify(tl->tl_spa, txg);
895 txg_list_remove(txg_list_t *tl, uint64_t txg)
897 int t = txg & TXG_MASK;
901 txg_verify(tl->tl_spa, txg);
920 txg_list_remove_this(txg_list_t *tl, void *p, uint64_t txg)
922 int t = txg & TXG_MASK;
925 txg_verify(tl->tl_spa, txg);
944 txg_list_member(txg_list_t *tl, void *p, uint64_t txg)
946 int t = txg & TXG_MASK;
949 txg_verify(tl->tl_spa, txg);
954 * Walk a txg list -- only safe if you know it's not changing.
957 txg_list_head(txg_list_t *tl, uint64_t txg)
959 int t = txg & TXG_MASK;
962 txg_verify(tl->tl_spa, txg);
967 txg_list_next(txg_list_t *tl, void *p, uint64_t txg)
969 int t = txg & TXG_MASK;
972 txg_verify(tl->tl_spa, txg);