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

Function txg_init

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

* Prepare the txg subsystem. */

Source from the content-addressed store, hash-verified

117 * Prepare the txg subsystem.
118 */
119void
120txg_init(dsl_pool_t *dp, uint64_t txg)
121{
122 tx_state_t *tx = &dp->dp_tx;
123 int c;
124 bzero(tx, sizeof (tx_state_t));
125
126 tx->tx_cpu = vmem_zalloc(max_ncpus * sizeof (tx_cpu_t), KM_SLEEP);
127
128 for (c = 0; c < max_ncpus; c++) {
129 int i;
130
131 mutex_init(&tx->tx_cpu[c].tc_lock, NULL, MUTEX_DEFAULT, NULL);
132 mutex_init(&tx->tx_cpu[c].tc_open_lock, NULL, MUTEX_NOLOCKDEP,
133 NULL);
134 for (i = 0; i < TXG_SIZE; i++) {
135 cv_init(&tx->tx_cpu[c].tc_cv[i], NULL, CV_DEFAULT,
136 NULL);
137 list_create(&tx->tx_cpu[c].tc_callbacks[i],
138 sizeof (dmu_tx_callback_t),
139 offsetof(dmu_tx_callback_t, dcb_node));
140 }
141 }
142
143 mutex_init(&tx->tx_sync_lock, NULL, MUTEX_DEFAULT, NULL);
144
145 cv_init(&tx->tx_sync_more_cv, NULL, CV_DEFAULT, NULL);
146 cv_init(&tx->tx_sync_done_cv, NULL, CV_DEFAULT, NULL);
147 cv_init(&tx->tx_quiesce_more_cv, NULL, CV_DEFAULT, NULL);
148 cv_init(&tx->tx_quiesce_done_cv, NULL, CV_DEFAULT, NULL);
149 cv_init(&tx->tx_exit_cv, NULL, CV_DEFAULT, NULL);
150
151 tx->tx_open_txg = txg;
152}
153
154/*
155 * Close down the txg subsystem.

Callers 1

dsl_pool_open_implFunction · 0.85

Calls 4

bzeroFunction · 0.85
mutex_initFunction · 0.50
cv_initFunction · 0.50
list_createFunction · 0.50

Tested by

no test coverage detected