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

Function ztest_replay_remove

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

Source from the content-addressed store, hash-verified

1932}
1933
1934static int
1935ztest_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
1936{
1937 ztest_ds_t *zd = arg1;
1938 lr_remove_t *lr = arg2;
1939 char *name = (void *)(lr + 1); /* name follows lr */
1940 objset_t *os = zd->zd_os;
1941 dmu_object_info_t doi;
1942 dmu_tx_t *tx;
1943 uint64_t object, txg;
1944
1945 if (byteswap)
1946 byteswap_uint64_array(lr, sizeof (*lr));
1947
1948 ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1949 ASSERT(name[0] != '\0');
1950
1951 VERIFY3U(0, ==,
1952 zap_lookup(os, lr->lr_doid, name, sizeof (object), 1, &object));
1953 ASSERT(object != 0);
1954
1955 ztest_object_lock(zd, object, RL_WRITER);
1956
1957 VERIFY3U(0, ==, dmu_object_info(os, object, &doi));
1958
1959 tx = dmu_tx_create(os);
1960
1961 dmu_tx_hold_zap(tx, lr->lr_doid, B_FALSE, name);
1962 dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END);
1963
1964 txg = ztest_tx_assign(tx, TXG_WAIT, FTAG);
1965 if (txg == 0) {
1966 ztest_object_unlock(zd, object);
1967 return (ENOSPC);
1968 }
1969
1970 if (doi.doi_type == DMU_OT_ZAP_OTHER) {
1971 VERIFY3U(0, ==, zap_destroy(os, object, tx));
1972 } else {
1973 VERIFY3U(0, ==, dmu_object_free(os, object, tx));
1974 }
1975
1976 VERIFY3U(0, ==, zap_remove(os, lr->lr_doid, name, tx));
1977
1978 (void) ztest_log_remove(zd, tx, lr, object);
1979
1980 dmu_tx_commit(tx);
1981
1982 ztest_object_unlock(zd, object);
1983
1984 return (0);
1985}
1986
1987static int
1988ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)

Callers 1

ztest_removeFunction · 0.85

Calls 14

byteswap_uint64_arrayFunction · 0.85
zap_lookupFunction · 0.85
ztest_object_lockFunction · 0.85
dmu_tx_createFunction · 0.85
dmu_tx_hold_zapFunction · 0.85
dmu_tx_hold_freeFunction · 0.85
ztest_tx_assignFunction · 0.85
ztest_object_unlockFunction · 0.85
zap_destroyFunction · 0.85
dmu_object_freeFunction · 0.85
zap_removeFunction · 0.85
ztest_log_removeFunction · 0.85

Tested by

no test coverage detected