| 1614 | #define TXG_MIGHTWAIT (ztest_random(10) == 0 ? TXG_NOWAIT : TXG_WAIT) |
| 1615 | |
| 1616 | static uint64_t |
| 1617 | ztest_tx_assign(dmu_tx_t *tx, uint64_t txg_how, const char *tag) |
| 1618 | { |
| 1619 | uint64_t txg; |
| 1620 | int error; |
| 1621 | |
| 1622 | /* |
| 1623 | * Attempt to assign tx to some transaction group. |
| 1624 | */ |
| 1625 | error = dmu_tx_assign(tx, txg_how); |
| 1626 | if (error) { |
| 1627 | if (error == ERESTART) { |
| 1628 | ASSERT(txg_how == TXG_NOWAIT); |
| 1629 | dmu_tx_wait(tx); |
| 1630 | } else { |
| 1631 | ASSERT3U(error, ==, ENOSPC); |
| 1632 | ztest_record_enospc(tag); |
| 1633 | } |
| 1634 | dmu_tx_abort(tx); |
| 1635 | return (0); |
| 1636 | } |
| 1637 | txg = dmu_tx_get_txg(tx); |
| 1638 | ASSERT(txg != 0); |
| 1639 | return (txg); |
| 1640 | } |
| 1641 | |
| 1642 | static void |
| 1643 | ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object, |
no test coverage detected