MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ztest_log_write

Function ztest_log_write

freebsd/contrib/openzfs/cmd/ztest/ztest.c:1777–1807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1775}
1776
1777static void
1778ztest_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
1809static void
1810ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr)

Callers 1

ztest_replay_writeFunction · 0.85

Calls 7

ztest_randomFunction · 0.85
zil_replayingFunction · 0.85
zil_max_log_dataFunction · 0.85
zil_itx_createFunction · 0.85
dmu_readFunction · 0.85
zil_itx_destroyFunction · 0.85
zil_itx_assignFunction · 0.85

Tested by

no test coverage detected