Lines Matching refs:lr
1943 ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr) in ztest_log_create() argument
1945 char *name = (char *)&lr->lr_data[0]; /* name follows lr */ in ztest_log_create()
1952 itx = zil_itx_create(TX_CREATE, sizeof (*lr) + namesize); in ztest_log_create()
1953 memcpy(&itx->itx_lr + 1, &lr->lr_create.lr_common + 1, in ztest_log_create()
1954 sizeof (*lr) + namesize - sizeof (lr_t)); in ztest_log_create()
1960 ztest_log_remove(ztest_ds_t *zd, dmu_tx_t *tx, lr_remove_t *lr, uint64_t object) in ztest_log_remove() argument
1962 char *name = (char *)&lr->lr_data[0]; /* name follows lr */ in ztest_log_remove()
1969 itx = zil_itx_create(TX_REMOVE, sizeof (*lr) + namesize); in ztest_log_remove()
1970 memcpy(&itx->itx_lr + 1, &lr->lr_common + 1, in ztest_log_remove()
1971 sizeof (*lr) + namesize - sizeof (lr_t)); in ztest_log_remove()
1978 ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr) in ztest_log_write() argument
1986 if (lr->lr_length > zil_max_log_data(zd->zd_zilog, sizeof (lr_write_t))) in ztest_log_write()
1990 sizeof (*lr) + (write_state == WR_COPIED ? lr->lr_length : 0)); in ztest_log_write()
1993 dmu_read(zd->zd_os, lr->lr_foid, lr->lr_offset, lr->lr_length, in ztest_log_write()
1996 itx = zil_itx_create(TX_WRITE, sizeof (*lr)); in ztest_log_write()
2003 memcpy(&itx->itx_lr + 1, &lr->lr_common + 1, in ztest_log_write()
2004 sizeof (*lr) - sizeof (lr_t)); in ztest_log_write()
2010 ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr) in ztest_log_truncate() argument
2017 itx = zil_itx_create(TX_TRUNCATE, sizeof (*lr)); in ztest_log_truncate()
2018 memcpy(&itx->itx_lr + 1, &lr->lr_common + 1, in ztest_log_truncate()
2019 sizeof (*lr) - sizeof (lr_t)); in ztest_log_truncate()
2026 ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_setattr_t *lr) in ztest_log_setattr() argument
2033 itx = zil_itx_create(TX_SETATTR, sizeof (*lr)); in ztest_log_setattr()
2034 memcpy(&itx->itx_lr + 1, &lr->lr_common + 1, in ztest_log_setattr()
2035 sizeof (*lr) - sizeof (lr_t)); in ztest_log_setattr()
2049 _lr_create_t *lr = &lrc->lr_create; in ztest_replay_create() local
2060 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_create()
2062 ASSERT3U(lr->lr_doid, ==, ZTEST_DIROBJ); in ztest_replay_create()
2067 dmu_tx_hold_zap(tx, lr->lr_doid, B_TRUE, name); in ztest_replay_create()
2069 if (lr->lrz_type == DMU_OT_ZAP_OTHER) { in ztest_replay_create()
2079 ASSERT3U(dmu_objset_zil(os)->zl_replay, ==, !!lr->lr_foid); in ztest_replay_create()
2080 bonuslen = DN_BONUS_SIZE(lr->lrz_dnodesize); in ztest_replay_create()
2082 if (lr->lrz_type == DMU_OT_ZAP_OTHER) { in ztest_replay_create()
2083 if (lr->lr_foid == 0) { in ztest_replay_create()
2084 lr->lr_foid = zap_create_dnsize(os, in ztest_replay_create()
2085 lr->lrz_type, lr->lrz_bonustype, in ztest_replay_create()
2086 bonuslen, lr->lrz_dnodesize, tx); in ztest_replay_create()
2088 error = zap_create_claim_dnsize(os, lr->lr_foid, in ztest_replay_create()
2089 lr->lrz_type, lr->lrz_bonustype, in ztest_replay_create()
2090 bonuslen, lr->lrz_dnodesize, tx); in ztest_replay_create()
2093 if (lr->lr_foid == 0) { in ztest_replay_create()
2094 lr->lr_foid = dmu_object_alloc_dnsize(os, in ztest_replay_create()
2095 lr->lrz_type, 0, lr->lrz_bonustype, in ztest_replay_create()
2096 bonuslen, lr->lrz_dnodesize, tx); in ztest_replay_create()
2098 error = dmu_object_claim_dnsize(os, lr->lr_foid, in ztest_replay_create()
2099 lr->lrz_type, 0, lr->lrz_bonustype, in ztest_replay_create()
2100 bonuslen, lr->lrz_dnodesize, tx); in ztest_replay_create()
2111 ASSERT3U(lr->lr_foid, !=, 0); in ztest_replay_create()
2113 if (lr->lrz_type != DMU_OT_ZAP_OTHER) in ztest_replay_create()
2114 VERIFY0(dmu_object_set_blocksize(os, lr->lr_foid, in ztest_replay_create()
2115 lr->lrz_blocksize, lr->lrz_ibshift, tx)); in ztest_replay_create()
2117 VERIFY0(dmu_bonus_hold(os, lr->lr_foid, FTAG, &db)); in ztest_replay_create()
2120 ztest_bt_generate(bbt, os, lr->lr_foid, lr->lrz_dnodesize, -1ULL, in ztest_replay_create()
2121 lr->lr_gen, txg, txg); in ztest_replay_create()
2122 ztest_fill_unused_bonus(db, bbt, lr->lr_foid, os, lr->lr_gen); in ztest_replay_create()
2125 VERIFY0(zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1, in ztest_replay_create()
2126 &lr->lr_foid, tx)); in ztest_replay_create()
2139 lr_remove_t *lr = arg2; in ztest_replay_remove() local
2140 char *name = (char *)&lr->lr_data[0]; /* name follows lr */ in ztest_replay_remove()
2147 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_remove()
2149 ASSERT3U(lr->lr_doid, ==, ZTEST_DIROBJ); in ztest_replay_remove()
2153 zap_lookup(os, lr->lr_doid, name, sizeof (object), 1, &object)); in ztest_replay_remove()
2162 dmu_tx_hold_zap(tx, lr->lr_doid, B_FALSE, name); in ztest_replay_remove()
2177 VERIFY0(zap_remove(os, lr->lr_doid, name, tx)); in ztest_replay_remove()
2179 (void) ztest_log_remove(zd, tx, lr, object); in ztest_replay_remove()
2192 lr_write_t *lr = arg2; in ztest_replay_write() local
2194 uint8_t *data = &lr->lr_data[0]; /* data follows lr */ in ztest_replay_write()
2206 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_write()
2208 offset = lr->lr_offset; in ztest_replay_write()
2209 length = lr->lr_length; in ztest_replay_write()
2212 if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { in ztest_replay_write()
2213 uint64_t blocksize = BP_GET_LSIZE(&lr->lr_blkptr); in ztest_replay_write()
2226 ztest_object_lock(zd, lr->lr_foid, ZTRL_READER); in ztest_replay_write()
2227 rl = ztest_range_lock(zd, lr->lr_foid, offset, length, ZTRL_WRITER); in ztest_replay_write()
2229 VERIFY0(dmu_bonus_hold(os, lr->lr_foid, FTAG, &db)); in ztest_replay_write()
2237 lrtxg = lr->lr_common.lrc_txg; in ztest_replay_write()
2241 dmu_tx_hold_write(tx, lr->lr_foid, offset, length); in ztest_replay_write()
2253 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_write()
2277 VERIFY(dmu_read(os, lr->lr_foid, offset, in ztest_replay_write()
2280 ztest_bt_verify(&rbt, os, lr->lr_foid, 0, in ztest_replay_write()
2292 ztest_bt_verify(bt, os, lr->lr_foid, 0, offset, in ztest_replay_write()
2301 ztest_bt_generate(bt, os, lr->lr_foid, 0, offset, gen, txg, in ztest_replay_write()
2306 dmu_write(os, lr->lr_foid, offset, length, data, tx); in ztest_replay_write()
2312 (void) ztest_log_write(zd, tx, lr); in ztest_replay_write()
2319 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_write()
2328 lr_truncate_t *lr = arg2; in ztest_replay_truncate() local
2335 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_truncate()
2337 ztest_object_lock(zd, lr->lr_foid, ZTRL_READER); in ztest_replay_truncate()
2338 rl = ztest_range_lock(zd, lr->lr_foid, lr->lr_offset, lr->lr_length, in ztest_replay_truncate()
2343 dmu_tx_hold_free(tx, lr->lr_foid, lr->lr_offset, lr->lr_length); in ztest_replay_truncate()
2348 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_truncate()
2352 VERIFY0(dmu_free_range(os, lr->lr_foid, lr->lr_offset, in ztest_replay_truncate()
2353 lr->lr_length, tx)); in ztest_replay_truncate()
2355 (void) ztest_log_truncate(zd, tx, lr); in ztest_replay_truncate()
2360 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_truncate()
2369 lr_setattr_t *lr = arg2; in ztest_replay_setattr() local
2377 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_setattr()
2379 ztest_object_lock(zd, lr->lr_foid, ZTRL_WRITER); in ztest_replay_setattr()
2381 VERIFY0(dmu_bonus_hold(os, lr->lr_foid, FTAG, &db)); in ztest_replay_setattr()
2384 dmu_tx_hold_bonus(tx, lr->lr_foid); in ztest_replay_setattr()
2389 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_setattr()
2396 lrtxg = lr->lr_common.lrc_txg; in ztest_replay_setattr()
2400 ASSERT3U(lr->lr_size, !=, 0); in ztest_replay_setattr()
2401 ASSERT3U(lr->lr_mode, !=, 0); in ztest_replay_setattr()
2407 lr->lr_size = (ztest_random(db->db_size / sizeof (*bbt)) + 1) * in ztest_replay_setattr()
2409 lr->lr_mode = bbt->bt_gen + 1; in ztest_replay_setattr()
2416 ztest_bt_verify(bbt, os, lr->lr_foid, dnodesize, -1ULL, lr->lr_mode, in ztest_replay_setattr()
2421 ASSERT3U(lr->lr_size, >=, sizeof (*bbt)); in ztest_replay_setattr()
2422 ASSERT3U(lr->lr_size, <=, db->db_size); in ztest_replay_setattr()
2423 VERIFY0(dmu_set_bonus(db, lr->lr_size, tx)); in ztest_replay_setattr()
2426 ztest_bt_generate(bbt, os, lr->lr_foid, dnodesize, -1ULL, lr->lr_mode, in ztest_replay_setattr()
2428 ztest_fill_unused_bonus(db, bbt, lr->lr_foid, os, bbt->bt_gen); in ztest_replay_setattr()
2431 (void) ztest_log_setattr(zd, tx, lr); in ztest_replay_setattr()
2435 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_setattr()
2487 ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf, in ztest_get_data() argument
2493 uint64_t object = lr->lr_foid; in ztest_get_data()
2494 uint64_t offset = lr->lr_offset; in ztest_get_data()
2495 uint64_t size = lr->lr_length; in ztest_get_data()
2496 uint64_t txg = lr->lr_common.lrc_txg; in ztest_get_data()
2552 blkptr_t *bp = &lr->lr_blkptr; in ztest_get_data()
2560 error = dmu_sync(zio, lr->lr_common.lrc_txg, in ztest_get_data()
2576 char *lr; in ztest_lr_alloc() local
2579 lr = umem_zalloc(lrsize + namesize, UMEM_NOFAIL); in ztest_lr_alloc()
2582 memcpy(lr + lrsize, name, namesize); in ztest_lr_alloc()
2584 return (lr); in ztest_lr_alloc()
2588 ztest_lr_free(void *lr, size_t lrsize, char *name) in ztest_lr_free() argument
2592 umem_free(lr, lrsize + namesize); in ztest_lr_free()
2656 _lr_create_t *lr = &lrc->lr_create; in ztest_create() local
2658 lr->lr_doid = od->od_dir; in ztest_create()
2659 lr->lr_foid = 0; /* 0 to allocate, > 0 to claim */ in ztest_create()
2660 lr->lrz_type = od->od_crtype; in ztest_create()
2661 lr->lrz_blocksize = od->od_crblocksize; in ztest_create()
2662 lr->lrz_ibshift = ztest_random_ibshift(); in ztest_create()
2663 lr->lrz_bonustype = DMU_OT_UINT64_OTHER; in ztest_create()
2664 lr->lrz_dnodesize = od->od_crdnodesize; in ztest_create()
2665 lr->lr_gen = od->od_crgen; in ztest_create()
2666 lr->lr_crtime[0] = time(NULL); in ztest_create()
2668 if (ztest_replay_create(zd, lr, B_FALSE) != 0) { in ztest_create()
2673 od->od_object = lr->lr_foid; in ztest_create()
2680 ztest_lr_free(lr, sizeof (*lr), od->od_name); in ztest_create()
2709 lr_remove_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name); in ztest_remove() local
2711 lr->lr_doid = od->od_dir; in ztest_remove()
2713 if ((error = ztest_replay_remove(zd, lr, B_FALSE)) != 0) { in ztest_remove()
2719 ztest_lr_free(lr, sizeof (*lr), od->od_name); in ztest_remove()
2729 lr_write_t *lr; in ztest_write() local
2732 lr = ztest_lr_alloc(sizeof (*lr) + size, NULL); in ztest_write()
2734 lr->lr_foid = object; in ztest_write()
2735 lr->lr_offset = offset; in ztest_write()
2736 lr->lr_length = size; in ztest_write()
2737 lr->lr_blkoff = 0; in ztest_write()
2738 BP_ZERO(&lr->lr_blkptr); in ztest_write()
2740 memcpy(&lr->lr_data[0], data, size); in ztest_write()
2742 error = ztest_replay_write(zd, lr, B_FALSE); in ztest_write()
2744 ztest_lr_free(lr, sizeof (*lr) + size, NULL); in ztest_write()
2752 lr_truncate_t *lr; in ztest_truncate() local
2755 lr = ztest_lr_alloc(sizeof (*lr), NULL); in ztest_truncate()
2757 lr->lr_foid = object; in ztest_truncate()
2758 lr->lr_offset = offset; in ztest_truncate()
2759 lr->lr_length = size; in ztest_truncate()
2761 error = ztest_replay_truncate(zd, lr, B_FALSE); in ztest_truncate()
2763 ztest_lr_free(lr, sizeof (*lr), NULL); in ztest_truncate()
2771 lr_setattr_t *lr; in ztest_setattr() local
2774 lr = ztest_lr_alloc(sizeof (*lr), NULL); in ztest_setattr()
2776 lr->lr_foid = object; in ztest_setattr()
2777 lr->lr_size = 0; in ztest_setattr()
2778 lr->lr_mode = 0; in ztest_setattr()
2780 error = ztest_replay_setattr(zd, lr, B_FALSE); in ztest_setattr()
2782 ztest_lr_free(lr, sizeof (*lr), NULL); in ztest_setattr()