Lines Matching defs:lr

1315 ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr)
1317 char *name = (void *)(lr + 1); /* name follows lr */
1324 itx = zil_itx_create(TX_CREATE, sizeof (*lr) + namesize);
1325 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1326 sizeof (*lr) + namesize - sizeof (lr_t));
1332 ztest_log_remove(ztest_ds_t *zd, dmu_tx_t *tx, lr_remove_t *lr, uint64_t object)
1334 char *name = (void *)(lr + 1); /* name follows lr */
1341 itx = zil_itx_create(TX_REMOVE, sizeof (*lr) + namesize);
1342 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1343 sizeof (*lr) + namesize - sizeof (lr_t));
1350 ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr)
1358 if (lr->lr_length > ZIL_MAX_LOG_DATA)
1362 sizeof (*lr) + (write_state == WR_COPIED ? lr->lr_length : 0));
1365 dmu_read(zd->zd_os, lr->lr_foid, lr->lr_offset, lr->lr_length,
1368 itx = zil_itx_create(TX_WRITE, sizeof (*lr));
1374 itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0);
1376 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1377 sizeof (*lr) - sizeof (lr_t));
1383 ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr)
1390 itx = zil_itx_create(TX_TRUNCATE, sizeof (*lr));
1391 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1392 sizeof (*lr) - sizeof (lr_t));
1399 ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_setattr_t *lr)
1406 itx = zil_itx_create(TX_SETATTR, sizeof (*lr));
1407 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1408 sizeof (*lr) - sizeof (lr_t));
1418 ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap)
1420 char *name = (void *)(lr + 1); /* name follows lr */
1429 byteswap_uint64_array(lr, sizeof (*lr));
1431 ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1436 dmu_tx_hold_zap(tx, lr->lr_doid, B_TRUE, name);
1438 if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
1448 ASSERT(dmu_objset_zil(os)->zl_replay == !!lr->lr_foid);
1450 if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
1451 if (lr->lr_foid == 0) {
1452 lr->lr_foid = zap_create(os,
1453 lr->lrz_type, lr->lrz_bonustype,
1454 lr->lrz_bonuslen, tx);
1456 error = zap_create_claim(os, lr->lr_foid,
1457 lr->lrz_type, lr->lrz_bonustype,
1458 lr->lrz_bonuslen, tx);
1461 if (lr->lr_foid == 0) {
1462 lr->lr_foid = dmu_object_alloc(os,
1463 lr->lrz_type, 0, lr->lrz_bonustype,
1464 lr->lrz_bonuslen, tx);
1466 error = dmu_object_claim(os, lr->lr_foid,
1467 lr->lrz_type, 0, lr->lrz_bonustype,
1468 lr->lrz_bonuslen, tx);
1479 ASSERT(lr->lr_foid != 0);
1481 if (lr->lrz_type != DMU_OT_ZAP_OTHER)
1482 VERIFY3U(0, ==, dmu_object_set_blocksize(os, lr->lr_foid,
1483 lr->lrz_blocksize, lr->lrz_ibshift, tx));
1485 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1488 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_gen, txg, txg);
1491 VERIFY3U(0, ==, zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1,
1492 &lr->lr_foid, tx));
1494 (void) ztest_log_create(zd, tx, lr);
1502 ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap)
1504 char *name = (void *)(lr + 1); /* name follows lr */
1511 byteswap_uint64_array(lr, sizeof (*lr));
1513 ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1517 zap_lookup(os, lr->lr_doid, name, sizeof (object), 1, &object));
1526 dmu_tx_hold_zap(tx, lr->lr_doid, B_FALSE, name);
1541 VERIFY3U(0, ==, zap_remove(os, lr->lr_doid, name, tx));
1543 (void) ztest_log_remove(zd, tx, lr, object);
1553 ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap)
1556 void *data = lr + 1; /* data follows lr */
1568 byteswap_uint64_array(lr, sizeof (*lr));
1570 offset = lr->lr_offset;
1571 length = lr->lr_length;
1574 if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
1575 uint64_t blocksize = BP_GET_LSIZE(&lr->lr_blkptr);
1588 ztest_object_lock(zd, lr->lr_foid, RL_READER);
1589 rl = ztest_range_lock(zd, lr->lr_foid, offset, length, RL_WRITER);
1591 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1599 lrtxg = lr->lr_common.lrc_txg;
1603 dmu_tx_hold_write(tx, lr->lr_foid, offset, length);
1615 ztest_object_unlock(zd, lr->lr_foid);
1631 VERIFY(dmu_read(os, lr->lr_foid, offset,
1634 ztest_bt_verify(&rbt, os, lr->lr_foid,
1646 ztest_bt_verify(bt, os, lr->lr_foid, offset,
1655 ztest_bt_generate(bt, os, lr->lr_foid, offset, gen, txg, crtxg);
1659 dmu_write(os, lr->lr_foid, offset, length, data, tx);
1665 (void) ztest_log_write(zd, tx, lr);
1672 ztest_object_unlock(zd, lr->lr_foid);
1678 ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap)
1686 byteswap_uint64_array(lr, sizeof (*lr));
1688 ztest_object_lock(zd, lr->lr_foid, RL_READER);
1689 rl = ztest_range_lock(zd, lr->lr_foid, lr->lr_offset, lr->lr_length,
1694 dmu_tx_hold_free(tx, lr->lr_foid, lr->lr_offset, lr->lr_length);
1699 ztest_object_unlock(zd, lr->lr_foid);
1703 VERIFY(dmu_free_range(os, lr->lr_foid, lr->lr_offset,
1704 lr->lr_length, tx) == 0);
1706 (void) ztest_log_truncate(zd, tx, lr);
1711 ztest_object_unlock(zd, lr->lr_foid);
1717 ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap)
1726 byteswap_uint64_array(lr, sizeof (*lr));
1728 ztest_object_lock(zd, lr->lr_foid, RL_WRITER);
1730 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1733 dmu_tx_hold_bonus(tx, lr->lr_foid);
1738 ztest_object_unlock(zd, lr->lr_foid);
1745 lrtxg = lr->lr_common.lrc_txg;
1748 ASSERT(lr->lr_size != 0);
1749 ASSERT(lr->lr_mode != 0);
1755 lr->lr_size = (ztest_random(db->db_size / sizeof (*bbt)) + 1) *
1757 lr->lr_mode = bbt->bt_gen + 1;
1764 ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
1769 ASSERT3U(lr->lr_size, >=, sizeof (*bbt));
1770 ASSERT3U(lr->lr_size, <=, db->db_size);
1771 VERIFY0(dmu_set_bonus(db, lr->lr_size, tx));
1774 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
1778 (void) ztest_log_setattr(zd, tx, lr);
1782 ztest_object_unlock(zd, lr->lr_foid);
1833 ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
1837 uint64_t object = lr->lr_foid;
1838 uint64_t offset = lr->lr_offset;
1839 uint64_t size = lr->lr_length;
1840 blkptr_t *bp = &lr->lr_blkptr;
1841 uint64_t txg = lr->lr_common.lrc_txg;
1906 error = dmu_sync(zio, lr->lr_common.lrc_txg,
1922 char *lr;
1925 lr = umem_zalloc(lrsize + namesize, UMEM_NOFAIL);
1928 bcopy(name, lr + lrsize, namesize);
1930 return (lr);
1934 ztest_lr_free(void *lr, size_t lrsize, char *name)
1938 umem_free(lr, lrsize + namesize);
1999 lr_create_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name);
2001 lr->lr_doid = od->od_dir;
2002 lr->lr_foid = 0; /* 0 to allocate, > 0 to claim */
2003 lr->lrz_type = od->od_crtype;
2004 lr->lrz_blocksize = od->od_crblocksize;
2005 lr->lrz_ibshift = ztest_random_ibshift();
2006 lr->lrz_bonustype = DMU_OT_UINT64_OTHER;
2007 lr->lrz_bonuslen = dmu_bonus_max();
2008 lr->lr_gen = od->od_crgen;
2009 lr->lr_crtime[0] = time(NULL);
2011 if (ztest_replay_create(zd, lr, B_FALSE) != 0) {
2016 od->od_object = lr->lr_foid;
2023 ztest_lr_free(lr, sizeof (*lr), od->od_name);
2051 lr_remove_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name);
2053 lr->lr_doid = od->od_dir;
2055 if ((error = ztest_replay_remove(zd, lr, B_FALSE)) != 0) {
2061 ztest_lr_free(lr, sizeof (*lr), od->od_name);
2071 lr_write_t *lr;
2074 lr = ztest_lr_alloc(sizeof (*lr) + size, NULL);
2076 lr->lr_foid = object;
2077 lr->lr_offset = offset;
2078 lr->lr_length = size;
2079 lr->lr_blkoff = 0;
2080 BP_ZERO(&lr->lr_blkptr);
2082 bcopy(data, lr + 1, size);
2084 error = ztest_replay_write(zd, lr, B_FALSE);
2086 ztest_lr_free(lr, sizeof (*lr) + size, NULL);
2094 lr_truncate_t *lr;
2097 lr = ztest_lr_alloc(sizeof (*lr), NULL);
2099 lr->lr_foid = object;
2100 lr->lr_offset = offset;
2101 lr->lr_length = size;
2103 error = ztest_replay_truncate(zd, lr, B_FALSE);
2105 ztest_lr_free(lr, sizeof (*lr), NULL);
2113 lr_setattr_t *lr;
2116 lr = ztest_lr_alloc(sizeof (*lr), NULL);
2118 lr->lr_foid = object;
2119 lr->lr_size = 0;
2120 lr->lr_mode = 0;
2122 error = ztest_replay_setattr(zd, lr, B_FALSE);
2124 ztest_lr_free(lr, sizeof (*lr), NULL);