| 2572 | } |
| 2573 | |
| 2574 | static void |
| 2575 | ztest_prealloc(ztest_ds_t *zd, uint64_t object, uint64_t offset, uint64_t size) |
| 2576 | { |
| 2577 | objset_t *os = zd->zd_os; |
| 2578 | dmu_tx_t *tx; |
| 2579 | uint64_t txg; |
| 2580 | rl_t *rl; |
| 2581 | |
| 2582 | txg_wait_synced(dmu_objset_pool(os), 0); |
| 2583 | |
| 2584 | ztest_object_lock(zd, object, RL_READER); |
| 2585 | rl = ztest_range_lock(zd, object, offset, size, RL_WRITER); |
| 2586 | |
| 2587 | tx = dmu_tx_create(os); |
| 2588 | |
| 2589 | dmu_tx_hold_write(tx, object, offset, size); |
| 2590 | |
| 2591 | txg = ztest_tx_assign(tx, TXG_WAIT, FTAG); |
| 2592 | |
| 2593 | if (txg != 0) { |
| 2594 | dmu_prealloc(os, object, offset, size, tx); |
| 2595 | dmu_tx_commit(tx); |
| 2596 | txg_wait_synced(dmu_objset_pool(os), txg); |
| 2597 | } else { |
| 2598 | (void) dmu_free_long_range(os, object, offset, size); |
| 2599 | } |
| 2600 | |
| 2601 | ztest_range_unlock(rl); |
| 2602 | ztest_object_unlock(zd, object); |
| 2603 | } |
| 2604 | |
| 2605 | static void |
| 2606 | ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset) |
no test coverage detected