• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/sys/contrib/openzfs/module/zfs/

Lines Matching defs:txg

44  * these transaction groups. Each successive transaction group (txg) is
47 * there may be an active txg associated with each state; each active txg may
49 * be up to three active txgs, and there is always a txg in the open state
52 * accepted into the txg in the open state, and are completed while the txg is
58 * When a new txg becomes active, it first enters the open state. New
60 * currently open txg. There is always a txg in the open state so that ZFS can
61 * accept new changes (though the txg may refuse new changes if it has hit
62 * some limit). ZFS advances the open txg to the next state for a variety of
68 * After a txg exits the open state, it enters the quiescing state. The
72 * operation without delaying either of the other states. Typically, a txg is
75 * transactions complete, the txg is ready to enter the next state.
102 * datasets. Note that when a synctask is initiated it enters the open txg,
103 * and ZFS then pushes that txg as quickly as possible to completion of the
107 * pool. Finally, if there is a quiesced txg waiting, we signal that it can
114 int zfs_txg_timeout = 5; /* max seconds worth of delta per txg */
117 * Prepare the txg subsystem.
120 txg_init(dsl_pool_t *dp, uint64_t txg)
151 tx->tx_open_txg = txg;
155 * Close down the txg subsystem.
296 * Get a handle on the currently open txg and keep it open.
298 * The txg is guaranteed to stay open until txg_rele_to_quiesce() is called for
299 * the handle. Once txg_rele_to_quiesce() has been called, the txg stays
304 * because the same txg can be returned multiple times in a row. This
321 uint64_t txg;
332 txg = tx->tx_open_txg;
335 tc->tc_count[txg & TXG_MASK]++;
339 th->th_txg = txg;
341 return (txg);
386 txg_quiesce(dsl_pool_t *dp, uint64_t txg)
390 int g = txg & TXG_MASK;
394 * Grab all tc_open_locks so nobody else can get into this txg.
399 ASSERT(txg == tx->tx_open_txg);
403 DTRACE_PROBE2(txg__quiescing, dsl_pool_t *, dp, uint64_t, txg);
413 spa_txg_history_set(dp->dp_spa, txg, TXG_STATE_OPEN, tx_open_time);
414 spa_txg_history_add(dp->dp_spa, txg + 1, tx_open_time);
428 spa_txg_history_set(dp->dp_spa, txg, TXG_STATE_QUIESCED, gethrtime());
442 * Dispatch the commit callbacks registered on this txg to worker threads.
448 txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg)
458 * only be called once a txg has been synced.
461 int g = txg & TXG_MASK;
541 uint64_t txg;
547 * on us, or the quiesce thread has handed off a txg to
564 * Wait until the quiesce thread hands off a txg to us,
578 * Consume the quiesced txg which has been handed off to
580 * able to quiesce another txg, so we must signal it.
583 txg = tx->tx_quiesced_txg;
585 tx->tx_syncing_txg = txg;
586 DTRACE_PROBE2(txg__syncing, dsl_pool_t *, dp, uint64_t, txg);
589 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
590 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
593 txg_stat_t *ts = spa_txg_history_init_io(spa, txg, dp);
595 spa_sync(spa, txg);
600 tx->tx_synced_txg = txg;
602 DTRACE_PROBE2(txg__synced, dsl_pool_t *, dp, uint64_t, txg);
608 txg_dispatch_callbacks(dp, txg);
622 uint64_t txg;
626 * However, we can only have one txg in "quiescing" or
628 * the "quiesced, waiting to sync" txg has been consumed
639 txg = tx->tx_open_txg;
640 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
641 txg, tx->tx_quiesce_txg_waiting,
643 tx->tx_quiescing_txg = txg;
646 txg_quiesce(dp, txg);
650 * Hand this txg off to the sync thread.
652 dprintf("quiesce done, handing off txg %llu\n", txg);
654 tx->tx_quiesced_txg = txg;
655 DTRACE_PROBE2(txg__quiesced, dsl_pool_t *, dp, uint64_t, txg);
663 * transaction group and there is already a waiting txg quiescing or quiesced.
664 * Abort the delay if this txg stalls or enters the quiescing state.
667 txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay, hrtime_t resolution)
672 /* don't delay if this txg could transition to quiescing immediately */
673 if (tx->tx_open_txg > txg ||
674 tx->tx_syncing_txg == txg-1 || tx->tx_synced_txg == txg-1)
678 if (tx->tx_open_txg > txg || tx->tx_synced_txg == txg-1) {
684 tx->tx_syncing_txg < txg-1 && !txg_stalled(dp)) {
695 txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig)
703 if (txg == 0)
704 txg = tx->tx_open_txg + TXG_DEFER_SIZE;
705 if (tx->tx_sync_txg_waiting < txg)
706 tx->tx_sync_txg_waiting = txg;
707 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
708 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
709 while (tx->tx_synced_txg < txg) {
718 * to resume waiting for this txg.
734 txg_wait_synced(dsl_pool_t *dp, uint64_t txg)
736 VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE));
744 txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg)
746 return (txg_wait_synced_impl(dp, txg, B_TRUE));
751 * when the current open txg should be quiesced immediately.
754 txg_wait_open(dsl_pool_t *dp, uint64_t txg, boolean_t should_quiesce)
762 if (txg == 0)
763 txg = tx->tx_open_txg + 1;
764 if (tx->tx_quiesce_txg_waiting < txg && should_quiesce)
765 tx->tx_quiesce_txg_waiting = txg;
766 dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
767 txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
768 while (tx->tx_open_txg < txg) {
787 * If there isn't a txg syncing or in the pipeline, push another txg through
788 * the pipeline by quiescing the open txg.
826 * Verify that this txg is active (open, quiescing, syncing). Non-active
827 * txg's should not be manipulated.
831 txg_verify(spa_t *spa, uint64_t txg)
834 if (txg <= TXG_INITIAL || txg == ZILTEST_TXG)
836 ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg);
837 ASSERT3U(txg, >=, dp->dp_tx.tx_synced_txg);
838 ASSERT3U(txg, >=, dp->dp_tx.tx_open_txg - TXG_CONCURRENT_STATES);
843 * Per-txg object lists.
860 txg_list_empty_impl(txg_list_t *tl, uint64_t txg)
863 TXG_VERIFY(tl->tl_spa, txg);
864 return (tl->tl_head[txg & TXG_MASK] == NULL);
868 txg_list_empty(txg_list_t *tl, uint64_t txg)
871 boolean_t ret = txg_list_empty_impl(tl, txg);
891 * Returns true if all txg lists are empty.
915 txg_list_add(txg_list_t *tl, void *p, uint64_t txg)
917 int t = txg & TXG_MASK;
921 TXG_VERIFY(tl->tl_spa, txg);
940 txg_list_add_tail(txg_list_t *tl, void *p, uint64_t txg)
942 int t = txg & TXG_MASK;
946 TXG_VERIFY(tl->tl_spa, txg);
968 txg_list_remove(txg_list_t *tl, uint64_t txg)
970 int t = txg & TXG_MASK;
974 TXG_VERIFY(tl->tl_spa, txg);
993 txg_list_remove_this(txg_list_t *tl, void *p, uint64_t txg)
995 int t = txg & TXG_MASK;
998 TXG_VERIFY(tl->tl_spa, txg);
1017 txg_list_member(txg_list_t *tl, void *p, uint64_t txg)
1019 int t = txg & TXG_MASK;
1022 TXG_VERIFY(tl->tl_spa, txg);
1027 * Walk a txg list
1030 txg_list_head(txg_list_t *tl, uint64_t txg)
1032 int t = txg & TXG_MASK;
1039 TXG_VERIFY(tl->tl_spa, txg);
1044 txg_list_next(txg_list_t *tl, void *p, uint64_t txg)
1046 int t = txg & TXG_MASK;
1049 TXG_VERIFY(tl->tl_spa, txg);
1075 "Max seconds worth of delta per txg");