Lines Matching refs:lr
1314 ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr) in ztest_log_create() argument
1316 char *name = (void *)(lr + 1); /* name follows lr */ in ztest_log_create()
1323 itx = zil_itx_create(TX_CREATE, sizeof (*lr) + namesize); in ztest_log_create()
1324 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, in ztest_log_create()
1325 sizeof (*lr) + namesize - sizeof (lr_t)); in ztest_log_create()
1331 ztest_log_remove(ztest_ds_t *zd, dmu_tx_t *tx, lr_remove_t *lr, uint64_t object) in ztest_log_remove() argument
1333 char *name = (void *)(lr + 1); /* name follows lr */ in ztest_log_remove()
1340 itx = zil_itx_create(TX_REMOVE, sizeof (*lr) + namesize); in ztest_log_remove()
1341 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, in ztest_log_remove()
1342 sizeof (*lr) + namesize - sizeof (lr_t)); in ztest_log_remove()
1349 ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr) in ztest_log_write() argument
1357 if (lr->lr_length > ZIL_MAX_LOG_DATA) in ztest_log_write()
1361 sizeof (*lr) + (write_state == WR_COPIED ? lr->lr_length : 0)); in ztest_log_write()
1364 dmu_read(zd->zd_os, lr->lr_foid, lr->lr_offset, lr->lr_length, in ztest_log_write()
1367 itx = zil_itx_create(TX_WRITE, sizeof (*lr)); in ztest_log_write()
1373 itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0); in ztest_log_write()
1375 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, in ztest_log_write()
1376 sizeof (*lr) - sizeof (lr_t)); in ztest_log_write()
1382 ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr) in ztest_log_truncate() argument
1389 itx = zil_itx_create(TX_TRUNCATE, sizeof (*lr)); in ztest_log_truncate()
1390 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, in ztest_log_truncate()
1391 sizeof (*lr) - sizeof (lr_t)); in ztest_log_truncate()
1398 ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_setattr_t *lr) in ztest_log_setattr() argument
1405 itx = zil_itx_create(TX_SETATTR, sizeof (*lr)); in ztest_log_setattr()
1406 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, in ztest_log_setattr()
1407 sizeof (*lr) - sizeof (lr_t)); in ztest_log_setattr()
1417 ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap) in ztest_replay_create() argument
1419 char *name = (void *)(lr + 1); /* name follows lr */ in ztest_replay_create()
1428 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_create()
1430 ASSERT(lr->lr_doid == ZTEST_DIROBJ); in ztest_replay_create()
1435 dmu_tx_hold_zap(tx, lr->lr_doid, B_TRUE, name); in ztest_replay_create()
1437 if (lr->lrz_type == DMU_OT_ZAP_OTHER) { in ztest_replay_create()
1447 ASSERT(dmu_objset_zil(os)->zl_replay == !!lr->lr_foid); in ztest_replay_create()
1449 if (lr->lrz_type == DMU_OT_ZAP_OTHER) { in ztest_replay_create()
1450 if (lr->lr_foid == 0) { in ztest_replay_create()
1451 lr->lr_foid = zap_create(os, in ztest_replay_create()
1452 lr->lrz_type, lr->lrz_bonustype, in ztest_replay_create()
1453 lr->lrz_bonuslen, tx); in ztest_replay_create()
1455 error = zap_create_claim(os, lr->lr_foid, in ztest_replay_create()
1456 lr->lrz_type, lr->lrz_bonustype, in ztest_replay_create()
1457 lr->lrz_bonuslen, tx); in ztest_replay_create()
1460 if (lr->lr_foid == 0) { in ztest_replay_create()
1461 lr->lr_foid = dmu_object_alloc(os, in ztest_replay_create()
1462 lr->lrz_type, 0, lr->lrz_bonustype, in ztest_replay_create()
1463 lr->lrz_bonuslen, tx); in ztest_replay_create()
1465 error = dmu_object_claim(os, lr->lr_foid, in ztest_replay_create()
1466 lr->lrz_type, 0, lr->lrz_bonustype, in ztest_replay_create()
1467 lr->lrz_bonuslen, tx); in ztest_replay_create()
1478 ASSERT(lr->lr_foid != 0); in ztest_replay_create()
1480 if (lr->lrz_type != DMU_OT_ZAP_OTHER) in ztest_replay_create()
1481 VERIFY3U(0, ==, dmu_object_set_blocksize(os, lr->lr_foid, in ztest_replay_create()
1482 lr->lrz_blocksize, lr->lrz_ibshift, tx)); in ztest_replay_create()
1484 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db)); in ztest_replay_create()
1487 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_gen, txg, txg); in ztest_replay_create()
1490 VERIFY3U(0, ==, zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1, in ztest_replay_create()
1491 &lr->lr_foid, tx)); in ztest_replay_create()
1493 (void) ztest_log_create(zd, tx, lr); in ztest_replay_create()
1501 ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap) in ztest_replay_remove() argument
1503 char *name = (void *)(lr + 1); /* name follows lr */ in ztest_replay_remove()
1510 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_remove()
1512 ASSERT(lr->lr_doid == ZTEST_DIROBJ); in ztest_replay_remove()
1516 zap_lookup(os, lr->lr_doid, name, sizeof (object), 1, &object)); in ztest_replay_remove()
1525 dmu_tx_hold_zap(tx, lr->lr_doid, B_FALSE, name); in ztest_replay_remove()
1540 VERIFY3U(0, ==, zap_remove(os, lr->lr_doid, name, tx)); in ztest_replay_remove()
1542 (void) ztest_log_remove(zd, tx, lr, object); in ztest_replay_remove()
1552 ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap) in ztest_replay_write() argument
1555 void *data = lr + 1; /* data follows lr */ in ztest_replay_write()
1567 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_write()
1569 offset = lr->lr_offset; in ztest_replay_write()
1570 length = lr->lr_length; in ztest_replay_write()
1573 if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { in ztest_replay_write()
1574 uint64_t blocksize = BP_GET_LSIZE(&lr->lr_blkptr); in ztest_replay_write()
1587 ztest_object_lock(zd, lr->lr_foid, RL_READER); in ztest_replay_write()
1588 rl = ztest_range_lock(zd, lr->lr_foid, offset, length, RL_WRITER); in ztest_replay_write()
1590 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db)); in ztest_replay_write()
1598 lrtxg = lr->lr_common.lrc_txg; in ztest_replay_write()
1602 dmu_tx_hold_write(tx, lr->lr_foid, offset, length); in ztest_replay_write()
1614 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_write()
1630 VERIFY(dmu_read(os, lr->lr_foid, offset, in ztest_replay_write()
1633 ztest_bt_verify(&rbt, os, lr->lr_foid, in ztest_replay_write()
1645 ztest_bt_verify(bt, os, lr->lr_foid, offset, in ztest_replay_write()
1654 ztest_bt_generate(bt, os, lr->lr_foid, offset, gen, txg, crtxg); in ztest_replay_write()
1658 dmu_write(os, lr->lr_foid, offset, length, data, tx); in ztest_replay_write()
1664 (void) ztest_log_write(zd, tx, lr); in ztest_replay_write()
1671 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_write()
1677 ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap) in ztest_replay_truncate() argument
1685 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_truncate()
1687 ztest_object_lock(zd, lr->lr_foid, RL_READER); in ztest_replay_truncate()
1688 rl = ztest_range_lock(zd, lr->lr_foid, lr->lr_offset, lr->lr_length, in ztest_replay_truncate()
1693 dmu_tx_hold_free(tx, lr->lr_foid, lr->lr_offset, lr->lr_length); in ztest_replay_truncate()
1698 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_truncate()
1702 VERIFY(dmu_free_range(os, lr->lr_foid, lr->lr_offset, in ztest_replay_truncate()
1703 lr->lr_length, tx) == 0); in ztest_replay_truncate()
1705 (void) ztest_log_truncate(zd, tx, lr); in ztest_replay_truncate()
1710 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_truncate()
1716 ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap) in ztest_replay_setattr() argument
1725 byteswap_uint64_array(lr, sizeof (*lr)); in ztest_replay_setattr()
1727 ztest_object_lock(zd, lr->lr_foid, RL_WRITER); in ztest_replay_setattr()
1729 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db)); in ztest_replay_setattr()
1732 dmu_tx_hold_bonus(tx, lr->lr_foid); in ztest_replay_setattr()
1737 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_setattr()
1744 lrtxg = lr->lr_common.lrc_txg; in ztest_replay_setattr()
1747 ASSERT(lr->lr_size != 0); in ztest_replay_setattr()
1748 ASSERT(lr->lr_mode != 0); in ztest_replay_setattr()
1754 lr->lr_size = (ztest_random(db->db_size / sizeof (*bbt)) + 1) * in ztest_replay_setattr()
1756 lr->lr_mode = bbt->bt_gen + 1; in ztest_replay_setattr()
1763 ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, in ztest_replay_setattr()
1768 ASSERT3U(lr->lr_size, >=, sizeof (*bbt)); in ztest_replay_setattr()
1769 ASSERT3U(lr->lr_size, <=, db->db_size); in ztest_replay_setattr()
1770 VERIFY0(dmu_set_bonus(db, lr->lr_size, tx)); in ztest_replay_setattr()
1773 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg); in ztest_replay_setattr()
1777 (void) ztest_log_setattr(zd, tx, lr); in ztest_replay_setattr()
1781 ztest_object_unlock(zd, lr->lr_foid); in ztest_replay_setattr()
1832 ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) in ztest_get_data() argument
1836 uint64_t object = lr->lr_foid; in ztest_get_data()
1837 uint64_t offset = lr->lr_offset; in ztest_get_data()
1838 uint64_t size = lr->lr_length; in ztest_get_data()
1839 blkptr_t *bp = &lr->lr_blkptr; in ztest_get_data()
1840 uint64_t txg = lr->lr_common.lrc_txg; in ztest_get_data()
1905 error = dmu_sync(zio, lr->lr_common.lrc_txg, in ztest_get_data()
1921 char *lr; in ztest_lr_alloc() local
1924 lr = umem_zalloc(lrsize + namesize, UMEM_NOFAIL); in ztest_lr_alloc()
1927 bcopy(name, lr + lrsize, namesize); in ztest_lr_alloc()
1929 return (lr); in ztest_lr_alloc()
1933 ztest_lr_free(void *lr, size_t lrsize, char *name) in ztest_lr_free() argument
1937 umem_free(lr, lrsize + namesize); in ztest_lr_free()
1998 lr_create_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name); in ztest_create() local
2000 lr->lr_doid = od->od_dir; in ztest_create()
2001 lr->lr_foid = 0; /* 0 to allocate, > 0 to claim */ in ztest_create()
2002 lr->lrz_type = od->od_crtype; in ztest_create()
2003 lr->lrz_blocksize = od->od_crblocksize; in ztest_create()
2004 lr->lrz_ibshift = ztest_random_ibshift(); in ztest_create()
2005 lr->lrz_bonustype = DMU_OT_UINT64_OTHER; in ztest_create()
2006 lr->lrz_bonuslen = dmu_bonus_max(); in ztest_create()
2007 lr->lr_gen = od->od_crgen; in ztest_create()
2008 lr->lr_crtime[0] = time(NULL); in ztest_create()
2010 if (ztest_replay_create(zd, lr, B_FALSE) != 0) { in ztest_create()
2015 od->od_object = lr->lr_foid; in ztest_create()
2022 ztest_lr_free(lr, sizeof (*lr), od->od_name); in ztest_create()
2050 lr_remove_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name); in ztest_remove() local
2052 lr->lr_doid = od->od_dir; in ztest_remove()
2054 if ((error = ztest_replay_remove(zd, lr, B_FALSE)) != 0) { in ztest_remove()
2060 ztest_lr_free(lr, sizeof (*lr), od->od_name); in ztest_remove()
2070 lr_write_t *lr; in ztest_write() local
2073 lr = ztest_lr_alloc(sizeof (*lr) + size, NULL); in ztest_write()
2075 lr->lr_foid = object; in ztest_write()
2076 lr->lr_offset = offset; in ztest_write()
2077 lr->lr_length = size; in ztest_write()
2078 lr->lr_blkoff = 0; in ztest_write()
2079 BP_ZERO(&lr->lr_blkptr); in ztest_write()
2081 bcopy(data, lr + 1, size); in ztest_write()
2083 error = ztest_replay_write(zd, lr, B_FALSE); in ztest_write()
2085 ztest_lr_free(lr, sizeof (*lr) + size, NULL); in ztest_write()
2093 lr_truncate_t *lr; in ztest_truncate() local
2096 lr = ztest_lr_alloc(sizeof (*lr), NULL); in ztest_truncate()
2098 lr->lr_foid = object; in ztest_truncate()
2099 lr->lr_offset = offset; in ztest_truncate()
2100 lr->lr_length = size; in ztest_truncate()
2102 error = ztest_replay_truncate(zd, lr, B_FALSE); in ztest_truncate()
2104 ztest_lr_free(lr, sizeof (*lr), NULL); in ztest_truncate()
2112 lr_setattr_t *lr; in ztest_setattr() local
2115 lr = ztest_lr_alloc(sizeof (*lr), NULL); in ztest_setattr()
2117 lr->lr_foid = object; in ztest_setattr()
2118 lr->lr_size = 0; in ztest_setattr()
2119 lr->lr_mode = 0; in ztest_setattr()
2121 error = ztest_replay_setattr(zd, lr, B_FALSE); in ztest_setattr()
2123 ztest_lr_free(lr, sizeof (*lr), NULL); in ztest_setattr()