| 1775 | } |
| 1776 | |
| 1777 | static void |
| 1778 | ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr) |
| 1779 | { |
| 1780 | itx_t *itx; |
| 1781 | itx_wr_state_t write_state = ztest_random(WR_NUM_STATES); |
| 1782 | |
| 1783 | if (zil_replaying(zd->zd_zilog, tx)) |
| 1784 | return; |
| 1785 | |
| 1786 | if (lr->lr_length > zil_max_log_data(zd->zd_zilog)) |
| 1787 | write_state = WR_INDIRECT; |
| 1788 | |
| 1789 | itx = zil_itx_create(TX_WRITE, |
| 1790 | sizeof (*lr) + (write_state == WR_COPIED ? lr->lr_length : 0)); |
| 1791 | |
| 1792 | if (write_state == WR_COPIED && |
| 1793 | dmu_read(zd->zd_os, lr->lr_foid, lr->lr_offset, lr->lr_length, |
| 1794 | ((lr_write_t *)&itx->itx_lr) + 1, DMU_READ_NO_PREFETCH) != 0) { |
| 1795 | zil_itx_destroy(itx); |
| 1796 | itx = zil_itx_create(TX_WRITE, sizeof (*lr)); |
| 1797 | write_state = WR_NEED_COPY; |
| 1798 | } |
| 1799 | itx->itx_private = zd; |
| 1800 | itx->itx_wr_state = write_state; |
| 1801 | itx->itx_sync = (ztest_random(8) == 0); |
| 1802 | |
| 1803 | bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, |
| 1804 | sizeof (*lr) - sizeof (lr_t)); |
| 1805 | |
| 1806 | zil_itx_assign(zd->zd_zilog, itx, tx); |
| 1807 | } |
| 1808 | |
| 1809 | static void |
| 1810 | ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr) |
no test coverage detected