Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

@@ -36,10 +36,11 @@
 #include <sys/dmu_objset.h>
 #include <sys/zap.h>
 #include <sys/zfeature.h>
 #include <sys/zfs_ioctl.h>
 #include <sys/dsl_deleg.h>
+#include <sys/dmu_impl.h>
 
 typedef struct dmu_snapshots_destroy_arg {
         nvlist_t *dsda_snaps;
         nvlist_t *dsda_successful_snaps;
         boolean_t dsda_defer;

@@ -446,11 +447,11 @@
                 VERIFY0(zap_destroy(mos, ds->ds_phys->ds_props_obj, tx));
         if (ds->ds_phys->ds_userrefs_obj != 0)
                 VERIFY0(zap_destroy(mos, ds->ds_phys->ds_userrefs_obj, tx));
         dsl_dir_rele(ds->ds_dir, ds);
         ds->ds_dir = NULL;
-        VERIFY0(dmu_object_free(mos, obj, tx));
+        dmu_object_free_zapified(mos, obj, tx);
 }
 
 static void
 dsl_destroy_snapshot_sync(void *arg, dmu_tx_t *tx)
 {

@@ -669,11 +670,11 @@
         VERIFY0(dsl_deleg_destroy(mos, dd->dd_phys->dd_deleg_zapobj, tx));
         VERIFY0(zap_remove(mos,
             dd->dd_parent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, tx));
 
         dsl_dir_rele(dd, FTAG);
-        VERIFY0(dmu_object_free(mos, ddobj, tx));
+        dmu_object_free_zapified(mos, ddobj, tx);
 }
 
 void
 dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
 {

@@ -722,14 +723,10 @@
 
                 ASSERT3U(ds->ds_prev->ds_phys->ds_num_children, >, 1);
                 ds->ds_prev->ds_phys->ds_num_children--;
         }
 
-        zfeature_info_t *async_destroy =
-            &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY];
-        objset_t *os;
-
         /*
          * Destroy the deadlist.  Unless it's a clone, the
          * deadlist should be empty.  (If it's a clone, it's
          * safe to ignore the deadlist contents.)
          */

@@ -736,13 +733,14 @@
         dsl_deadlist_close(&ds->ds_deadlist);
         dsl_deadlist_free(mos, ds->ds_phys->ds_deadlist_obj, tx);
         dmu_buf_will_dirty(ds->ds_dbuf, tx);
         ds->ds_phys->ds_deadlist_obj = 0;
 
+        objset_t *os;
         VERIFY0(dmu_objset_from_ds(ds, &os));
 
-        if (!spa_feature_is_enabled(dp->dp_spa, async_destroy)) {
+        if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_ASYNC_DESTROY)) {
                 old_synchronous_dataset_destroy(ds, tx);
         } else {
                 /*
                  * Move the bptree into the pool's list of trees to
                  * clean up and update space accounting information.

@@ -749,14 +747,15 @@
                  */
                 uint64_t used, comp, uncomp;
 
                 zil_destroy_sync(dmu_objset_zil(os), tx);
 
-                if (!spa_feature_is_active(dp->dp_spa, async_destroy)) {
+                if (!spa_feature_is_active(dp->dp_spa,
+                    SPA_FEATURE_ASYNC_DESTROY)) {
                         dsl_scan_t *scn = dp->dp_scan;
-
-                        spa_feature_incr(dp->dp_spa, async_destroy, tx);
+                        spa_feature_incr(dp->dp_spa, SPA_FEATURE_ASYNC_DESTROY,
+                            tx);
                         dp->dp_bptree_obj = bptree_alloc(mos, tx);
                         VERIFY0(zap_add(mos,
                             DMU_POOL_DIRECTORY_OBJECT,
                             DMU_POOL_BPTREE_OBJ, sizeof (uint64_t), 1,
                             &dp->dp_bptree_obj, tx));

@@ -812,11 +811,11 @@
         ASSERT0(ds->ds_phys->ds_next_clones_obj);
         ASSERT0(ds->ds_phys->ds_props_obj);
         ASSERT0(ds->ds_phys->ds_userrefs_obj);
         dsl_dir_rele(ds->ds_dir, ds);
         ds->ds_dir = NULL;
-        VERIFY0(dmu_object_free(mos, obj, tx));
+        dmu_object_free_zapified(mos, obj, tx);
 
         dsl_dir_destroy_sync(ddobj, tx);
 
         if (rmorigin) {
                 dsl_dataset_t *prev;

@@ -868,12 +867,11 @@
 #endif
 
         error = spa_open(name, &spa, FTAG);
         if (error != 0)
                 return (error);
-        isenabled = spa_feature_is_enabled(spa,
-            &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY]);
+        isenabled = spa_feature_is_enabled(spa, SPA_FEATURE_ASYNC_DESTROY);
         spa_close(spa, FTAG);
 
         ddha.ddha_name = name;
 
         if (!isenabled) {