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

Function ztest_replay_create

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

* ZIL replay ops */

Source from the content-addressed store, hash-verified

1842 * ZIL replay ops
1843 */
1844static int
1845ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
1846{
1847 ztest_ds_t *zd = arg1;
1848 lr_create_t *lr = arg2;
1849 char *name = (void *)(lr + 1); /* name follows lr */
1850 objset_t *os = zd->zd_os;
1851 ztest_block_tag_t *bbt;
1852 dmu_buf_t *db;
1853 dmu_tx_t *tx;
1854 uint64_t txg;
1855 int error = 0;
1856 int bonuslen;
1857
1858 if (byteswap)
1859 byteswap_uint64_array(lr, sizeof (*lr));
1860
1861 ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1862 ASSERT(name[0] != '\0');
1863
1864 tx = dmu_tx_create(os);
1865
1866 dmu_tx_hold_zap(tx, lr->lr_doid, B_TRUE, name);
1867
1868 if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
1869 dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, B_TRUE, NULL);
1870 } else {
1871 dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT);
1872 }
1873
1874 txg = ztest_tx_assign(tx, TXG_WAIT, FTAG);
1875 if (txg == 0)
1876 return (ENOSPC);
1877
1878 ASSERT(dmu_objset_zil(os)->zl_replay == !!lr->lr_foid);
1879 bonuslen = DN_BONUS_SIZE(lr->lrz_dnodesize);
1880
1881 if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
1882 if (lr->lr_foid == 0) {
1883 lr->lr_foid = zap_create_dnsize(os,
1884 lr->lrz_type, lr->lrz_bonustype,
1885 bonuslen, lr->lrz_dnodesize, tx);
1886 } else {
1887 error = zap_create_claim_dnsize(os, lr->lr_foid,
1888 lr->lrz_type, lr->lrz_bonustype,
1889 bonuslen, lr->lrz_dnodesize, tx);
1890 }
1891 } else {
1892 if (lr->lr_foid == 0) {
1893 lr->lr_foid = dmu_object_alloc_dnsize(os,
1894 lr->lrz_type, 0, lr->lrz_bonustype,
1895 bonuslen, lr->lrz_dnodesize, tx);
1896 } else {
1897 error = dmu_object_claim_dnsize(os, lr->lr_foid,
1898 lr->lrz_type, 0, lr->lrz_bonustype,
1899 bonuslen, lr->lrz_dnodesize, tx);
1900 }
1901 }

Callers 1

ztest_createFunction · 0.85

Calls 15

byteswap_uint64_arrayFunction · 0.85
dmu_tx_createFunction · 0.85
dmu_tx_hold_zapFunction · 0.85
dmu_tx_hold_bonusFunction · 0.85
ztest_tx_assignFunction · 0.85
dmu_objset_zilFunction · 0.85
zap_create_dnsizeFunction · 0.85
zap_create_claim_dnsizeFunction · 0.85
dmu_object_alloc_dnsizeFunction · 0.85
dmu_object_claim_dnsizeFunction · 0.85
dmu_tx_commitFunction · 0.85
dmu_object_set_blocksizeFunction · 0.85

Tested by

no test coverage detected