Document monotonicity of dmu_tx_assign() and txg_hold_open()

Expand the comments to make it clear exactly what is guaranteed
by dmu_tx_assign() and txg_hold_open().  Additionally, update
the comment which refers to txg_exit() when it should reference
txg_rele_to_sync().

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Christian Schwarz <me@cschwarz.com>
Closes #11521
This commit is contained in:
Christian Schwarz
2021-01-25 13:13:45 +01:00
committed by Brian Behlendorf
parent 9eee7fce3b
commit 84268b099b
2 changed files with 39 additions and 1 deletions
+16
View File
@@ -1012,6 +1012,22 @@ dmu_tx_unassign(dmu_tx_t *tx)
* details on the throttle). This is used by the VFS operations, after
* they have already called dmu_tx_wait() (though most likely on a
* 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
dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how)