Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
Show All 37 Lines | |||||
#include <sys/dsl_scan.h> | #include <sys/dsl_scan.h> | ||||
#include <sys/dmu_objset.h> | #include <sys/dmu_objset.h> | ||||
#include <sys/zap.h> | #include <sys/zap.h> | ||||
#include <sys/zfeature.h> | #include <sys/zfeature.h> | ||||
#include <sys/zfs_ioctl.h> | #include <sys/zfs_ioctl.h> | ||||
#include <sys/dsl_deleg.h> | #include <sys/dsl_deleg.h> | ||||
#include <sys/dmu_impl.h> | #include <sys/dmu_impl.h> | ||||
#include <sys/zcp.h> | #include <sys/zcp.h> | ||||
#if defined(__FreeBSD__) && defined(_KERNEL) | |||||
#include <sys/zvol.h> | |||||
#endif | |||||
int | int | ||||
dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boolean_t defer) | dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boolean_t defer) | ||||
{ | { | ||||
if (!ds->ds_is_snapshot) | if (!ds->ds_is_snapshot) | ||||
return (SET_ERROR(EINVAL)); | return (SET_ERROR(EINVAL)); | ||||
if (dsl_dataset_long_held(ds)) | if (dsl_dataset_long_held(ds)) | ||||
return (SET_ERROR(EBUSY)); | return (SET_ERROR(EBUSY)); | ||||
▲ Show 20 Lines • Show All 429 Lines • ▼ Show 20 Lines | VERIFY0(dmu_object_free(mos, | ||||
dsl_dataset_phys(ds)->ds_next_clones_obj, tx)); | dsl_dataset_phys(ds)->ds_next_clones_obj, tx)); | ||||
} | } | ||||
if (dsl_dataset_phys(ds)->ds_props_obj != 0) | if (dsl_dataset_phys(ds)->ds_props_obj != 0) | ||||
VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_props_obj, | VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_props_obj, | ||||
tx)); | tx)); | ||||
if (dsl_dataset_phys(ds)->ds_userrefs_obj != 0) | if (dsl_dataset_phys(ds)->ds_userrefs_obj != 0) | ||||
VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_userrefs_obj, | VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_userrefs_obj, | ||||
tx)); | tx)); | ||||
#if defined(__FreeBSD__) && defined(_KERNEL) | |||||
char dsname[ZFS_MAX_DATASET_NAME_LEN]; | |||||
dsl_dataset_name(ds, dsname); | |||||
zvol_remove_minors(dp->dp_spa, dsname); | |||||
#endif | |||||
dsl_dir_rele(ds->ds_dir, ds); | dsl_dir_rele(ds->ds_dir, ds); | ||||
ds->ds_dir = NULL; | ds->ds_dir = NULL; | ||||
dmu_object_free_zapified(mos, obj, tx); | dmu_object_free_zapified(mos, obj, tx); | ||||
} | } | ||||
void | void | ||||
dsl_destroy_snapshot_sync(void *arg, dmu_tx_t *tx) | dsl_destroy_snapshot_sync(void *arg, dmu_tx_t *tx) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 474 Lines • ▼ Show 20 Lines | |||||
dsl_destroy_head_sync(void *arg, dmu_tx_t *tx) | dsl_destroy_head_sync(void *arg, dmu_tx_t *tx) | ||||
{ | { | ||||
dsl_destroy_head_arg_t *ddha = arg; | dsl_destroy_head_arg_t *ddha = arg; | ||||
dsl_pool_t *dp = dmu_tx_pool(tx); | dsl_pool_t *dp = dmu_tx_pool(tx); | ||||
dsl_dataset_t *ds; | dsl_dataset_t *ds; | ||||
VERIFY0(dsl_dataset_hold(dp, ddha->ddha_name, FTAG, &ds)); | VERIFY0(dsl_dataset_hold(dp, ddha->ddha_name, FTAG, &ds)); | ||||
dsl_destroy_head_sync_impl(ds, tx); | dsl_destroy_head_sync_impl(ds, tx); | ||||
#if defined(__FreeBSD__) && defined(_KERNEL) | |||||
zvol_remove_minors(dp->dp_spa, ddha->ddha_name); | |||||
#endif | |||||
dsl_dataset_rele(ds, FTAG); | dsl_dataset_rele(ds, FTAG); | ||||
} | } | ||||
static void | static void | ||||
dsl_destroy_head_begin_sync(void *arg, dmu_tx_t *tx) | dsl_destroy_head_begin_sync(void *arg, dmu_tx_t *tx) | ||||
{ | { | ||||
dsl_destroy_head_arg_t *ddha = arg; | dsl_destroy_head_arg_t *ddha = arg; | ||||
dsl_pool_t *dp = dmu_tx_pool(tx); | dsl_pool_t *dp = dmu_tx_pool(tx); | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |