Print this page

        

@@ -85,10 +85,11 @@
 #include <sys/mman.h>
 #include <sys/resource.h>
 #include <sys/zio.h>
 #include <sys/zio_checksum.h>
 #include <sys/zio_compress.h>
+#include <sys/zio_crypt.h>
 #include <sys/zil.h>
 #include <sys/vdev_impl.h>
 #include <sys/vdev_file.h>
 #include <sys/spa_impl.h>
 #include <sys/dsl_prop.h>

@@ -696,10 +697,16 @@
 ztest_random_compress(void)
 {
         return ((uint8_t)ztest_random(ZIO_COMPRESS_FUNCTIONS));
 }
 
+static uint8_t
+ztest_random_crypt(void)
+{
+        return ((uint8_t)ztest_random(ZIO_CRYPT_FUNCTIONS));
+}
+
 static int
 ztest_replay_create(objset_t *os, lr_create_t *lr, boolean_t byteswap)
 {
         dmu_tx_t *tx;
         int error;

@@ -1545,10 +1552,12 @@
 
                 dmu_object_set_checksum(os, batchobj,
                     ztest_random_checksum(), tx);
                 dmu_object_set_compress(os, batchobj,
                     ztest_random_compress(), tx);
+                dmu_object_set_crypt(os, batchobj,
+                    ztest_random_crypt(), tx);
 
                 dmu_write(os, batchobj, b * sizeof (uint64_t),
                     sizeof (uint64_t), &object, tx);
 
                 dmu_tx_commit(tx);

@@ -1606,10 +1615,12 @@
 
                 dmu_object_set_checksum(os, object,
                     ztest_random_checksum(), tx);
                 dmu_object_set_compress(os, object,
                     ztest_random_compress(), tx);
+                dmu_object_set_crypt(os, object,
+                    ztest_random_crypt(), tx);
 
                 dmu_write(os, batchobj, b * sizeof (uint64_t),
                     sizeof (uint64_t), &object, tx);
 
                 /*

@@ -2446,19 +2457,23 @@
 
         (void) rw_rdlock(&ztest_shared->zs_name_lock);
 
         dmu_objset_name(os, osname);
 
-        for (i = 0; i < 2; i++) {
+        for (i = 0; i < 3; i++) {
                 if (i == 0) {
                         prop = "checksum";
                         value = ztest_random_checksum();
                         inherit = (value == ZIO_CHECKSUM_INHERIT);
-                } else {
+                } else if (i == 1) {
                         prop = "compression";
                         value = ztest_random_compress();
                         inherit = (value == ZIO_COMPRESS_INHERIT);
+                } else {
+                        prop = "crypt";
+                        value = ztest_random_crypt();
+                        inherit = (value == ZIO_CRYPT_INHERIT);
                 }
 
                 error = dsl_prop_set(osname, prop, sizeof (value),
                     !inherit, &value);
 

@@ -2470,15 +2485,19 @@
                 ASSERT3U(error, ==, 0);
 
                 VERIFY3U(dsl_prop_get(osname, prop, sizeof (value),
                     1, &value, setpoint), ==, 0);
 
-                if (i == 0)
+                if (i == 0) {
                         valname = zio_checksum_table[value].ci_name;
-                else
+                } else if (i == 1) {
                         valname = zio_compress_table[value].ci_name;
+                } else {
+                        valname = zio_crypt_table[value].ci_name;
+                }
 
+
                 if (zopt_verbose >= 6) {
                         (void) printf("%s %s = %s for '%s'\n",
                             osname, prop, valname, setpoint);
                 }
         }