Deleted Added
full compact
ztest.c (240133) ztest.c (240415)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 967 unchanged lines hidden (view full) ---

976 error = dsl_prop_set(osname, propname,
977 (inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL),
978 sizeof (value), 1, &value);
979
980 if (error == ENOSPC) {
981 ztest_record_enospc(FTAG);
982 return (error);
983 }
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 967 unchanged lines hidden (view full) ---

976 error = dsl_prop_set(osname, propname,
977 (inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL),
978 sizeof (value), 1, &value);
979
980 if (error == ENOSPC) {
981 ztest_record_enospc(FTAG);
982 return (error);
983 }
984 ASSERT3U(error, ==, 0);
984 ASSERT0(error);
985
986 VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
987 1, &curval, setpoint), ==, 0);
988
989 if (ztest_opts.zo_verbose >= 6) {
990 VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0);
991 (void) printf("%s %s = %s at '%s'\n",
992 osname, propname, valname, setpoint);

--- 15 unchanged lines hidden (view full) ---

1008 error = spa_prop_set(spa, props);
1009
1010 nvlist_free(props);
1011
1012 if (error == ENOSPC) {
1013 ztest_record_enospc(FTAG);
1014 return (error);
1015 }
985
986 VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
987 1, &curval, setpoint), ==, 0);
988
989 if (ztest_opts.zo_verbose >= 6) {
990 VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0);
991 (void) printf("%s %s = %s at '%s'\n",
992 osname, propname, valname, setpoint);

--- 15 unchanged lines hidden (view full) ---

1008 error = spa_prop_set(spa, props);
1009
1010 nvlist_free(props);
1011
1012 if (error == ENOSPC) {
1013 ztest_record_enospc(FTAG);
1014 return (error);
1015 }
1016 ASSERT3U(error, ==, 0);
1016 ASSERT0(error);
1017
1018 return (error);
1019}
1020
1021static void
1022ztest_rll_init(rll_t *rll)
1023{
1024 rll->rll_writer = NULL;

--- 680 unchanged lines hidden (view full) ---

1705 */
1706 ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
1707 MAX(txg, lrtxg), crtxg);
1708
1709 dmu_buf_will_dirty(db, tx);
1710
1711 ASSERT3U(lr->lr_size, >=, sizeof (*bbt));
1712 ASSERT3U(lr->lr_size, <=, db->db_size);
1017
1018 return (error);
1019}
1020
1021static void
1022ztest_rll_init(rll_t *rll)
1023{
1024 rll->rll_writer = NULL;

--- 680 unchanged lines hidden (view full) ---

1705 */
1706 ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
1707 MAX(txg, lrtxg), crtxg);
1708
1709 dmu_buf_will_dirty(db, tx);
1710
1711 ASSERT3U(lr->lr_size, >=, sizeof (*bbt));
1712 ASSERT3U(lr->lr_size, <=, db->db_size);
1713 VERIFY3U(dmu_set_bonus(db, lr->lr_size, tx), ==, 0);
1713 VERIFY0(dmu_set_bonus(db, lr->lr_size, tx));
1714 bbt = ztest_bt_bonus(db);
1715
1716 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
1717
1718 dmu_buf_rele(db, FTAG);
1719
1720 (void) ztest_log_setattr(zd, tx, lr);
1721

--- 1318 unchanged lines hidden (view full) ---

3040
3041 /*
3042 * Verify that the dataset contains a directory object.
3043 */
3044 VERIFY3U(0, ==, dmu_objset_hold(name, FTAG, &os));
3045 error = dmu_object_info(os, ZTEST_DIROBJ, &doi);
3046 if (error != ENOENT) {
3047 /* We could have crashed in the middle of destroying it */
1714 bbt = ztest_bt_bonus(db);
1715
1716 ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
1717
1718 dmu_buf_rele(db, FTAG);
1719
1720 (void) ztest_log_setattr(zd, tx, lr);
1721

--- 1318 unchanged lines hidden (view full) ---

3040
3041 /*
3042 * Verify that the dataset contains a directory object.
3043 */
3044 VERIFY3U(0, ==, dmu_objset_hold(name, FTAG, &os));
3045 error = dmu_object_info(os, ZTEST_DIROBJ, &doi);
3046 if (error != ENOENT) {
3047 /* We could have crashed in the middle of destroying it */
3048 ASSERT3U(error, ==, 0);
3048 ASSERT0(error);
3049 ASSERT3U(doi.doi_type, ==, DMU_OT_ZAP_OTHER);
3050 ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
3051 }
3052 dmu_objset_rele(os, FTAG);
3053
3054 /*
3055 * Destroy the dataset.
3056 */

--- 396 unchanged lines hidden (view full) ---

3453 */
3454 freeit = (ztest_random(100) < free_percent);
3455
3456 /*
3457 * Read the current contents of our objects.
3458 */
3459 error = dmu_read(os, packobj, packoff, packsize, packbuf,
3460 DMU_READ_PREFETCH);
3049 ASSERT3U(doi.doi_type, ==, DMU_OT_ZAP_OTHER);
3050 ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
3051 }
3052 dmu_objset_rele(os, FTAG);
3053
3054 /*
3055 * Destroy the dataset.
3056 */

--- 396 unchanged lines hidden (view full) ---

3453 */
3454 freeit = (ztest_random(100) < free_percent);
3455
3456 /*
3457 * Read the current contents of our objects.
3458 */
3459 error = dmu_read(os, packobj, packoff, packsize, packbuf,
3460 DMU_READ_PREFETCH);
3461 ASSERT3U(error, ==, 0);
3461 ASSERT0(error);
3462 error = dmu_read(os, bigobj, bigoff, bigsize, bigbuf,
3463 DMU_READ_PREFETCH);
3462 error = dmu_read(os, bigobj, bigoff, bigsize, bigbuf,
3463 DMU_READ_PREFETCH);
3464 ASSERT3U(error, ==, 0);
3464 ASSERT0(error);
3465
3466 /*
3467 * Get a tx for the mods to both packobj and bigobj.
3468 */
3469 tx = dmu_tx_create(os);
3470
3471 dmu_tx_hold_write(tx, packobj, packoff, packsize);
3472

--- 293 unchanged lines hidden (view full) ---

3766 /*
3767 * 50% of the time don't read objects in the 1st iteration to
3768 * test dmu_assign_arcbuf() for the case when there're no
3769 * existing dbufs for the specified offsets.
3770 */
3771 if (i != 0 || ztest_random(2) != 0) {
3772 error = dmu_read(os, packobj, packoff,
3773 packsize, packbuf, DMU_READ_PREFETCH);
3465
3466 /*
3467 * Get a tx for the mods to both packobj and bigobj.
3468 */
3469 tx = dmu_tx_create(os);
3470
3471 dmu_tx_hold_write(tx, packobj, packoff, packsize);
3472

--- 293 unchanged lines hidden (view full) ---

3766 /*
3767 * 50% of the time don't read objects in the 1st iteration to
3768 * test dmu_assign_arcbuf() for the case when there're no
3769 * existing dbufs for the specified offsets.
3770 */
3771 if (i != 0 || ztest_random(2) != 0) {
3772 error = dmu_read(os, packobj, packoff,
3773 packsize, packbuf, DMU_READ_PREFETCH);
3774 ASSERT3U(error, ==, 0);
3774 ASSERT0(error);
3775 error = dmu_read(os, bigobj, bigoff, bigsize,
3776 bigbuf, DMU_READ_PREFETCH);
3775 error = dmu_read(os, bigobj, bigoff, bigsize,
3776 bigbuf, DMU_READ_PREFETCH);
3777 ASSERT3U(error, ==, 0);
3777 ASSERT0(error);
3778 }
3779 compare_and_update_pbbufs(s, packbuf, bigbuf, bigsize,
3780 n, chunksize, txg);
3781
3782 /*
3783 * We've verified all the old bufwads, and made new ones.
3784 * Now write them out.
3785 */

--- 254 unchanged lines hidden (view full) ---

4040 (void) sprintf(propname, "prop_%llu", (u_longlong_t)prop);
4041 (void) sprintf(txgname, "txg_%llu", (u_longlong_t)prop);
4042
4043 error = zap_length(os, object, txgname, &zl_intsize, &zl_ints);
4044
4045 if (error == ENOENT)
4046 return;
4047
3778 }
3779 compare_and_update_pbbufs(s, packbuf, bigbuf, bigsize,
3780 n, chunksize, txg);
3781
3782 /*
3783 * We've verified all the old bufwads, and made new ones.
3784 * Now write them out.
3785 */

--- 254 unchanged lines hidden (view full) ---

4040 (void) sprintf(propname, "prop_%llu", (u_longlong_t)prop);
4041 (void) sprintf(txgname, "txg_%llu", (u_longlong_t)prop);
4042
4043 error = zap_length(os, object, txgname, &zl_intsize, &zl_ints);
4044
4045 if (error == ENOENT)
4046 return;
4047
4048 ASSERT3U(error, ==, 0);
4048 ASSERT0(error);
4049
4050 tx = dmu_tx_create(os);
4051 dmu_tx_hold_zap(tx, object, B_TRUE, NULL);
4052 txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
4053 if (txg == 0)
4054 return;
4055 VERIFY3U(0, ==, zap_remove(os, object, txgname, tx));
4056 VERIFY3U(0, ==, zap_remove(os, object, propname, tx));

--- 179 unchanged lines hidden (view full) ---

4236 if (data->zcd_txg > synced_txg)
4237 fatal(0, "commit callback of txg %" PRIu64 " called prematurely"
4238 ", last synced txg = %" PRIu64 "\n", data->zcd_txg,
4239 synced_txg);
4240
4241 data->zcd_called = B_TRUE;
4242
4243 if (error == ECANCELED) {
4049
4050 tx = dmu_tx_create(os);
4051 dmu_tx_hold_zap(tx, object, B_TRUE, NULL);
4052 txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
4053 if (txg == 0)
4054 return;
4055 VERIFY3U(0, ==, zap_remove(os, object, txgname, tx));
4056 VERIFY3U(0, ==, zap_remove(os, object, propname, tx));

--- 179 unchanged lines hidden (view full) ---

4236 if (data->zcd_txg > synced_txg)
4237 fatal(0, "commit callback of txg %" PRIu64 " called prematurely"
4238 ", last synced txg = %" PRIu64 "\n", data->zcd_txg,
4239 synced_txg);
4240
4241 data->zcd_called = B_TRUE;
4242
4243 if (error == ECANCELED) {
4244 ASSERT3U(data->zcd_txg, ==, 0);
4244 ASSERT0(data->zcd_txg);
4245 ASSERT(!data->zcd_added);
4246
4247 /*
4248 * The private callback data should be destroyed here, but
4249 * since we are going to check the zcd_called field after
4250 * dmu_tx_abort(), we will destroy it there.
4251 */
4252 return;

--- 188 unchanged lines hidden (view full) ---

4441{
4442 nvlist_t *props = NULL;
4443
4444 (void) rw_rdlock(&ztest_name_lock);
4445
4446 (void) ztest_spa_prop_set_uint64(ZPOOL_PROP_DEDUPDITTO,
4447 ZIO_DEDUPDITTO_MIN + ztest_random(ZIO_DEDUPDITTO_MIN));
4448
4245 ASSERT(!data->zcd_added);
4246
4247 /*
4248 * The private callback data should be destroyed here, but
4249 * since we are going to check the zcd_called field after
4250 * dmu_tx_abort(), we will destroy it there.
4251 */
4252 return;

--- 188 unchanged lines hidden (view full) ---

4441{
4442 nvlist_t *props = NULL;
4443
4444 (void) rw_rdlock(&ztest_name_lock);
4445
4446 (void) ztest_spa_prop_set_uint64(ZPOOL_PROP_DEDUPDITTO,
4447 ZIO_DEDUPDITTO_MIN + ztest_random(ZIO_DEDUPDITTO_MIN));
4448
4449 VERIFY3U(spa_prop_get(ztest_spa, &props), ==, 0);
4449 VERIFY0(spa_prop_get(ztest_spa, &props));
4450
4451 if (ztest_opts.zo_verbose >= 6)
4452 dump_nvlist(props, 4);
4453
4454 nvlist_free(props);
4455
4456 (void) rw_unlock(&ztest_name_lock);
4457}

--- 808 unchanged lines hidden (view full) ---

5266 error = ztest_dataset_create(name);
5267 if (error == ENOSPC) {
5268 (void) rw_unlock(&ztest_name_lock);
5269 ztest_record_enospc(FTAG);
5270 return (error);
5271 }
5272 ASSERT(error == 0 || error == EEXIST);
5273
4450
4451 if (ztest_opts.zo_verbose >= 6)
4452 dump_nvlist(props, 4);
4453
4454 nvlist_free(props);
4455
4456 (void) rw_unlock(&ztest_name_lock);
4457}

--- 808 unchanged lines hidden (view full) ---

5266 error = ztest_dataset_create(name);
5267 if (error == ENOSPC) {
5268 (void) rw_unlock(&ztest_name_lock);
5269 ztest_record_enospc(FTAG);
5270 return (error);
5271 }
5272 ASSERT(error == 0 || error == EEXIST);
5273
5274 VERIFY3U(dmu_objset_hold(name, zd, &os), ==, 0);
5274 VERIFY0(dmu_objset_hold(name, zd, &os));
5275 (void) rw_unlock(&ztest_name_lock);
5276
5277 ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os);
5278
5279 zilog = zd->zd_zilog;
5280
5281 if (zilog->zl_header->zh_claim_lr_seq != 0 &&
5282 zilog->zl_header->zh_claim_lr_seq < committed_seq)

--- 772 unchanged lines hidden ---
5275 (void) rw_unlock(&ztest_name_lock);
5276
5277 ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os);
5278
5279 zilog = zd->zd_zilog;
5280
5281 if (zilog->zl_header->zh_claim_lr_seq != 0 &&
5282 zilog->zl_header->zh_claim_lr_seq < committed_seq)

--- 772 unchanged lines hidden ---