Lines Matching refs:lr

1319 ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr)
1321 char *name = (void *)(lr + 1); /* name follows lr */
1328 itx = zil_itx_create(TX_CREATE, sizeof (*lr) + namesize);
1329 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1330 sizeof (*lr) + namesize - sizeof (lr_t));
1336 ztest_log_remove(ztest_ds_t *zd, dmu_tx_t *tx, lr_remove_t *lr, uint64_t object)
1338 char *name = (void *)(lr + 1); /* name follows lr */
1345 itx = zil_itx_create(TX_REMOVE, sizeof (*lr) + namesize);
1346 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1347 sizeof (*lr) + namesize - sizeof (lr_t));
1354 ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr)
1362 if (lr->lr_length > ZIL_MAX_LOG_DATA)
1366 sizeof (*lr) + (write_state == WR_COPIED ? lr->lr_length : 0));
1369 dmu_read(zd->zd_os, lr->lr_foid, lr->lr_offset, lr->lr_length,
1372 itx = zil_itx_create(TX_WRITE, sizeof (*lr));
1378 itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0);
1380 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1381 sizeof (*lr) - sizeof (lr_t));
1387 ztest_log_truncate(ztest_ds_t *zd, dmu_tx_t *tx, lr_truncate_t *lr)
1394 itx = zil_itx_create(TX_TRUNCATE, sizeof (*lr));
1395 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1396 sizeof (*lr) - sizeof (lr_t));
1403 ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_setattr_t *lr)
1410 itx = zil_itx_create(TX_SETATTR, sizeof (*lr));
1411 bcopy(&lr->lr_common + 1, &itx->itx_lr + 1,
1412 sizeof (*lr) - sizeof (lr_t));
1422 ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap)
1424 char *name = (void *)(lr + 1); /* name follows lr */
1433 byteswap_uint64_array(lr, sizeof (*lr));
1435 ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1440 dmu_tx_hold_zap(tx, lr->lr_doid, B_TRUE, name);
1442 if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
1452 ASSERT(dmu_objset_zil(os)->zl_replay == !!lr->lr_foid);
1454 if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
1455 if (lr->lr_foid == 0) {
1456 lr->lr_foid = zap_create(os,
1457 lr->lrz_type, lr->lrz_bonustype,
1458 lr->lrz_bonuslen, tx);
1460 error = zap_create_claim(os, lr->lr_foid,
1461 lr->lrz_type, lr->lrz_bonustype,
1462 lr->lrz_bonuslen, tx);
1465 if (lr->lr_foid == 0) {
1466 lr->lr_foid = dmu_object_alloc(os,
1467 lr->lrz_type, 0, lr->lrz_bonustype,
1468 lr->lrz_bonuslen, tx);
1470 error = dmu_object_claim(os, lr->lr_foid,
1471 lr->lrz_type, 0, lr->lrz_bonustype,
1472 lr->lrz_bonuslen, tx);
1483 ASSERT(lr->lr_foid != 0);
1485 if (lr->lrz_type != DMU_OT_ZAP_OTHER)
1486 VERIFY3U(0, ==, dmu_object_set_blocksize(os, lr->lr_foid,
1487 lr->lrz_blocksize, lr->lrz_ibshift, tx));
1489 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1492 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_gen, txg, txg);
1495 VERIFY3U(0, ==, zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1,
1496 &lr->lr_foid, tx));
1498 (void) ztest_log_create(zd, tx, lr);
1506 ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap)
1508 char *name = (void *)(lr + 1); /* name follows lr */
1515 byteswap_uint64_array(lr, sizeof (*lr));
1517 ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1521 zap_lookup(os, lr->lr_doid, name, sizeof (object), 1, &object));
1530 dmu_tx_hold_zap(tx, lr->lr_doid, B_FALSE, name);
1545 VERIFY3U(0, ==, zap_remove(os, lr->lr_doid, name, tx));
1547 (void) ztest_log_remove(zd, tx, lr, object);
1557 ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap)
1560 void *data = lr + 1; /* data follows lr */
1572 byteswap_uint64_array(lr, sizeof (*lr));
1574 offset = lr->lr_offset;
1575 length = lr->lr_length;
1578 if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
1579 uint64_t blocksize = BP_GET_LSIZE(&lr->lr_blkptr);
1592 ztest_object_lock(zd, lr->lr_foid, RL_READER);
1593 rl = ztest_range_lock(zd, lr->lr_foid, offset, length, RL_WRITER);
1595 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1603 lrtxg = lr->lr_common.lrc_txg;
1607 dmu_tx_hold_write(tx, lr->lr_foid, offset, length);
1619 ztest_object_unlock(zd, lr->lr_foid);
1635 VERIFY(dmu_read(os, lr->lr_foid, offset,
1638 ztest_bt_verify(&rbt, os, lr->lr_foid,
1650 ztest_bt_verify(bt, os, lr->lr_foid, offset,
1659 ztest_bt_generate(bt, os, lr->lr_foid, offset, gen, txg, crtxg);
1663 dmu_write(os, lr->lr_foid, offset, length, data, tx);
1669 (void) ztest_log_write(zd, tx, lr);
1676 ztest_object_unlock(zd, lr->lr_foid);
1682 ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap)
1690 byteswap_uint64_array(lr, sizeof (*lr));
1692 ztest_object_lock(zd, lr->lr_foid, RL_READER);
1693 rl = ztest_range_lock(zd, lr->lr_foid, lr->lr_offset, lr->lr_length,
1698 dmu_tx_hold_free(tx, lr->lr_foid, lr->lr_offset, lr->lr_length);
1703 ztest_object_unlock(zd, lr->lr_foid);
1707 VERIFY(dmu_free_range(os, lr->lr_foid, lr->lr_offset,
1708 lr->lr_length, tx) == 0);
1710 (void) ztest_log_truncate(zd, tx, lr);
1715 ztest_object_unlock(zd, lr->lr_foid);
1721 ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap)
1730 byteswap_uint64_array(lr, sizeof (*lr));
1732 ztest_object_lock(zd, lr->lr_foid, RL_WRITER);
1734 VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1737 dmu_tx_hold_bonus(tx, lr->lr_foid);
1742 ztest_object_unlock(zd, lr->lr_foid);
1749 lrtxg = lr->lr_common.lrc_txg;
1752 ASSERT(lr->lr_size != 0);
1753 ASSERT(lr->lr_mode != 0);
1759 lr->lr_size = (ztest_random(db->db_size / sizeof (*bbt)) + 1) *
1761 lr->lr_mode = bbt->bt_gen + 1;
1768 ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
1773 ASSERT3U(lr->lr_size, >=, sizeof (*bbt));
1774 ASSERT3U(lr->lr_size, <=, db->db_size);
1775 VERIFY0(dmu_set_bonus(db, lr->lr_size, tx));
1778 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
1782 (void) ztest_log_setattr(zd, tx, lr);
1786 ztest_object_unlock(zd, lr->lr_foid);
1837 ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
1841 uint64_t object = lr->lr_foid;
1842 uint64_t offset = lr->lr_offset;
1843 uint64_t size = lr->lr_length;
1844 blkptr_t *bp = &lr->lr_blkptr;
1845 uint64_t txg = lr->lr_common.lrc_txg;
1910 error = dmu_sync(zio, lr->lr_common.lrc_txg,
1926 char *lr;
1929 lr = umem_zalloc(lrsize + namesize, UMEM_NOFAIL);
1932 bcopy(name, lr + lrsize, namesize);
1934 return (lr);
1938 ztest_lr_free(void *lr, size_t lrsize, char *name)
1942 umem_free(lr, lrsize + namesize);
2003 lr_create_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name);
2005 lr->lr_doid = od->od_dir;
2006 lr->lr_foid = 0; /* 0 to allocate, > 0 to claim */
2007 lr->lrz_type = od->od_crtype;
2008 lr->lrz_blocksize = od->od_crblocksize;
2009 lr->lrz_ibshift = ztest_random_ibshift();
2010 lr->lrz_bonustype = DMU_OT_UINT64_OTHER;
2011 lr->lrz_bonuslen = dmu_bonus_max();
2012 lr->lr_gen = od->od_crgen;
2013 lr->lr_crtime[0] = time(NULL);
2015 if (ztest_replay_create(zd, lr, B_FALSE) != 0) {
2020 od->od_object = lr->lr_foid;
2027 ztest_lr_free(lr, sizeof (*lr), od->od_name);
2055 lr_remove_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name);
2057 lr->lr_doid = od->od_dir;
2059 if ((error = ztest_replay_remove(zd, lr, B_FALSE)) != 0) {
2065 ztest_lr_free(lr, sizeof (*lr), od->od_name);
2075 lr_write_t *lr;
2078 lr = ztest_lr_alloc(sizeof (*lr) + size, NULL);
2080 lr->lr_foid = object;
2081 lr->lr_offset = offset;
2082 lr->lr_length = size;
2083 lr->lr_blkoff = 0;
2084 BP_ZERO(&lr->lr_blkptr);
2086 bcopy(data, lr + 1, size);
2088 error = ztest_replay_write(zd, lr, B_FALSE);
2090 ztest_lr_free(lr, sizeof (*lr) + size, NULL);
2098 lr_truncate_t *lr;
2101 lr = ztest_lr_alloc(sizeof (*lr), NULL);
2103 lr->lr_foid = object;
2104 lr->lr_offset = offset;
2105 lr->lr_length = size;
2107 error = ztest_replay_truncate(zd, lr, B_FALSE);
2109 ztest_lr_free(lr, sizeof (*lr), NULL);
2117 lr_setattr_t *lr;
2120 lr = ztest_lr_alloc(sizeof (*lr), NULL);
2122 lr->lr_foid = object;
2123 lr->lr_size = 0;
2124 lr->lr_mode = 0;
2126 error = ztest_replay_setattr(zd, lr, B_FALSE);
2128 ztest_lr_free(lr, sizeof (*lr), NULL);