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,45 **** --- 36,46 ---- #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,456 **** 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)); } static void dsl_destroy_snapshot_sync(void *arg, dmu_tx_t *tx) { --- 447,457 ---- 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; ! dmu_object_free_zapified(mos, obj, tx); } static void dsl_destroy_snapshot_sync(void *arg, dmu_tx_t *tx) {
*** 669,679 **** 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)); } void dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx) { --- 670,680 ---- 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); ! dmu_object_free_zapified(mos, ddobj, tx); } void dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx) {
*** 722,735 **** 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.) */ --- 723,732 ----
*** 736,748 **** 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; VERIFY0(dmu_objset_from_ds(ds, &os)); ! if (!spa_feature_is_enabled(dp->dp_spa, 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. --- 733,746 ---- 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, 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,762 **** */ uint64_t used, comp, uncomp; zil_destroy_sync(dmu_objset_zil(os), tx); ! if (!spa_feature_is_active(dp->dp_spa, async_destroy)) { dsl_scan_t *scn = dp->dp_scan; ! ! spa_feature_incr(dp->dp_spa, 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)); --- 747,761 ---- */ uint64_t used, comp, uncomp; zil_destroy_sync(dmu_objset_zil(os), tx); ! 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, 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,822 **** 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)); dsl_dir_destroy_sync(ddobj, tx); if (rmorigin) { dsl_dataset_t *prev; --- 811,821 ---- 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; ! dmu_object_free_zapified(mos, obj, tx); dsl_dir_destroy_sync(ddobj, tx); if (rmorigin) { dsl_dataset_t *prev;
*** 868,879 **** #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]); spa_close(spa, FTAG); ddha.ddha_name = name; if (!isenabled) { --- 867,877 ---- #endif error = spa_open(name, &spa, FTAG); if (error != 0) return (error); ! isenabled = spa_feature_is_enabled(spa, SPA_FEATURE_ASYNC_DESTROY); spa_close(spa, FTAG); ddha.ddha_name = name; if (!isenabled) {