| 1932 | } |
| 1933 | |
| 1934 | static int |
| 1935 | ztest_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 | |
| 1987 | static int |
| 1988 | ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap) |
no test coverage detected