Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/zfs/dmu_tx.c
Show First 20 Lines • Show All 1,006 Lines • ▼ Show 20 Lines | |||||
* ERESTART error, the caller should drop all locks, call dmu_tx_wait(), | * ERESTART error, the caller should drop all locks, call dmu_tx_wait(), | ||||
* and try again. | * and try again. | ||||
* | * | ||||
* If TXG_NOTHROTTLE is set, this indicates that this tx should not be | * If TXG_NOTHROTTLE is set, this indicates that this tx should not be | ||||
* delayed due on the ZFS Write Throttle (see comments in dsl_pool.c for | * delayed due on the ZFS Write Throttle (see comments in dsl_pool.c for | ||||
* details on the throttle). This is used by the VFS operations, after | * details on the throttle). This is used by the VFS operations, after | ||||
* they have already called dmu_tx_wait() (though most likely on a | * they have already called dmu_tx_wait() (though most likely on a | ||||
* different tx). | * different tx). | ||||
* | |||||
* It is guaranteed that subsequent successful calls to dmu_tx_assign() | |||||
* will assign the tx to monotonically increasing txgs. Of course this is | |||||
* not strong monotonicity, because the same txg can be returned multiple | |||||
* times in a row. This guarantee holds both for subsequent calls from | |||||
* one thread and for multiple threads. For example, it is impossible to | |||||
* observe the following sequence of events: | |||||
* | |||||
* Thread 1 Thread 2 | |||||
* | |||||
* dmu_tx_assign(T1, ...) | |||||
* 1 <- dmu_tx_get_txg(T1) | |||||
* dmu_tx_assign(T2, ...) | |||||
* 2 <- dmu_tx_get_txg(T2) | |||||
* dmu_tx_assign(T3, ...) | |||||
* 1 <- dmu_tx_get_txg(T3) | |||||
*/ | */ | ||||
int | int | ||||
dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how) | dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how) | ||||
{ | { | ||||
int err; | int err; | ||||
ASSERT(tx->tx_txg == 0); | ASSERT(tx->tx_txg == 0); | ||||
ASSERT0(txg_how & ~(TXG_WAIT | TXG_NOTHROTTLE)); | ASSERT0(txg_how & ~(TXG_WAIT | TXG_NOTHROTTLE)); | ||||
▲ Show 20 Lines • Show All 379 Lines • Show Last 20 Lines |