summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/opensolaris/cmd/ztest
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2011-11-28 21:40:00 +0000
committermm <mm@FreeBSD.org>2011-11-28 21:40:00 +0000
commit73cab7197174153a718dedc97ff344341bcf6098 (patch)
tree77fe89756134ff0449a9b13c294d9097b13f8db5 /cddl/contrib/opensolaris/cmd/ztest
parent72bf877ee7fec77d840c6cdf8e327dfcbe244e6e (diff)
downloadFreeBSD-src-73cab7197174153a718dedc97ff344341bcf6098.zip
FreeBSD-src-73cab7197174153a718dedc97ff344341bcf6098.tar.gz
Merge new ZFS features from illumos:
1644 add ZFS "clones" property https://www.illumos.org/issues/1644 1645 add ZFS "written" and "written@..." properties https://www.illumos.org/issues/1645 1646 "zfs send" should estimate size of stream https://www.illumos.org/issues/1646 1647 "zfs destroy" should determine space reclaimed by destroying multiple snapshots https://www.illumos.org/issues/1647 1693 persistent 'comment' field for a zpool https://www.illumos.org/issues/1693 1708 adjust size of zpool history data https://www.illumos.org/issues/1708 1748 desire support for reguid in zfs https://www.illumos.org/issues/1748 Obtained from: illumos (changesets 13514, 13524, 13525) MFC after: 1 month
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/ztest')
-rw-r--r--cddl/contrib/opensolaris/cmd/ztest/ztest.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
index d90961e..3a6c350 100644
--- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c
+++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -259,6 +260,7 @@ ztest_func_t ztest_vdev_LUN_growth;
ztest_func_t ztest_vdev_add_remove;
ztest_func_t ztest_vdev_aux_add_remove;
ztest_func_t ztest_split_pool;
+ztest_func_t ztest_reguid;
uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
@@ -289,6 +291,7 @@ ztest_info_t ztest_info[] = {
{ ztest_fault_inject, 1, &zopt_sometimes },
{ ztest_ddt_repair, 1, &zopt_sometimes },
{ ztest_dmu_snapshot_hold, 1, &zopt_sometimes },
+ { ztest_reguid, 1, &zopt_sometimes },
{ ztest_spa_rename, 1, &zopt_rarely },
{ ztest_scrub, 1, &zopt_rarely },
{ ztest_dsl_dataset_promote_busy, 1, &zopt_rarely },
@@ -325,6 +328,7 @@ typedef struct ztest_shared {
uint64_t zs_vdev_aux;
uint64_t zs_alloc;
uint64_t zs_space;
+ uint64_t zs_guid;
mutex_t zs_vdev_lock;
rwlock_t zs_name_lock;
ztest_info_t zs_info[ZTEST_FUNCS];
@@ -4646,7 +4650,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
object = od[0].od_object;
blocksize = od[0].od_blocksize;
- pattern = spa_guid(spa) ^ dmu_objset_fsid_guid(os);
+ pattern = zs->zs_guid ^ dmu_objset_fsid_guid(os);
ASSERT(object != 0);
@@ -4717,6 +4721,31 @@ ztest_scrub(ztest_ds_t *zd, uint64_t id)
}
/*
+ * Change the guid for the pool.
+ */
+/* ARGSUSED */
+void
+ztest_reguid(ztest_ds_t *zd, uint64_t id)
+{
+ ztest_shared_t *zs = ztest_shared;
+ spa_t *spa = zs->zs_spa;
+ uint64_t orig, load;
+
+ orig = spa_guid(spa);
+ load = spa_load_guid(spa);
+ if (spa_change_guid(spa) != 0)
+ return;
+
+ if (zopt_verbose >= 3) {
+ (void) printf("Changed guid old %llu -> %llu\n",
+ (u_longlong_t)orig, (u_longlong_t)spa_guid(spa));
+ }
+
+ VERIFY3U(orig, !=, spa_guid(spa));
+ VERIFY3U(load, ==, spa_load_guid(spa));
+}
+
+/*
* Rename the pool to a different name and then rename it back.
*/
/* ARGSUSED */
@@ -5145,6 +5174,7 @@ ztest_run(ztest_shared_t *zs)
{
thread_t *tid;
spa_t *spa;
+ objset_t *os;
thread_t resume_tid;
int error;
@@ -5176,6 +5206,10 @@ ztest_run(ztest_shared_t *zs)
spa->spa_debug = B_TRUE;
zs->zs_spa = spa;
+ VERIFY3U(0, ==, dmu_objset_hold(zs->zs_pool, FTAG, &os));
+ zs->zs_guid = dmu_objset_fsid_guid(os);
+ dmu_objset_rele(os, FTAG);
+
spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN;
/*
OpenPOWER on IntegriCloud