vdev_t *vd = spa->spa_root_vdev;
nvlist_t *nv = NULL;
uint64_t version = spa_version(spa);
- enum zio_checksum checksum;
+ uint64_t checksum, compress, refresrv, vbs, dedup;
ASSERT(MUTEX_HELD(&zfsdev_state_lock));
ASSERT(vd->vdev_ops == &vdev_root_ops);
error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, 0,
DMU_OBJECT_END);
+ if (error != 0)
+ return (error);
/* wait for dmu_free_long_range to actually free the blocks */
txg_wait_synced(dmu_objset_pool(zv->zv_objset), 0);
2, ZFS_SPACE_CHECK_RESERVED);
}
+ if (!resize) {
+ error = dsl_prop_get_integer(zv->zv_name,
+ zfs_prop_to_name(ZFS_PROP_COMPRESSION), &compress, NULL);
+ if (error == 0) {
+ error = dsl_prop_get_integer(zv->zv_name,
+ zfs_prop_to_name(ZFS_PROP_CHECKSUM), &checksum,
+ NULL);
+ }
+ if (error == 0) {
+ error = dsl_prop_get_integer(zv->zv_name,
+ zfs_prop_to_name(ZFS_PROP_REFRESERVATION),
+ &refresrv, NULL);
+ }
+ if (error == 0) {
+ error = dsl_prop_get_integer(zv->zv_name,
+ zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &vbs,
+ NULL);
+ }
+ if (version >= SPA_VERSION_DEDUP && error == 0) {
+ error = dsl_prop_get_integer(zv->zv_name,
+ zfs_prop_to_name(ZFS_PROP_DEDUP), &dedup, NULL);
+ }
+ }
+ if (error != 0)
+ return (error);
+
tx = dmu_tx_create(os);
dmu_tx_hold_zap(tx, ZVOL_ZAP_OBJ, TRUE, NULL);
dmu_tx_hold_bonus(tx, ZVOL_OBJ);
error = dmu_tx_assign(tx, TXG_WAIT);
- if (error) {
+ if (error != 0) {
dmu_tx_abort(tx);
return (error);
}
- /*
- * If MULTI_VDEV_CRASH_DUMP is active, use the NOPARITY checksum
- * function. Otherwise, use the old default -- OFF.
- */
- checksum = spa_feature_is_active(spa,
- SPA_FEATURE_MULTI_VDEV_CRASH_DUMP) ? ZIO_CHECKSUM_NOPARITY :
- ZIO_CHECKSUM_OFF;
-
/*
* If we are resizing the dump device then we only need to
* update the refreservation to match the newly updated
zfs_prop_to_name(ZFS_PROP_REFRESERVATION), 8, 1,
&zv->zv_volsize, tx);
} else {
- uint64_t checksum, compress, refresrv, vbs, dedup;
-
- error = dsl_prop_get_integer(zv->zv_name,
- zfs_prop_to_name(ZFS_PROP_COMPRESSION), &compress, NULL);
- error = error ? error : dsl_prop_get_integer(zv->zv_name,
- zfs_prop_to_name(ZFS_PROP_CHECKSUM), &checksum, NULL);
- error = error ? error : dsl_prop_get_integer(zv->zv_name,
- zfs_prop_to_name(ZFS_PROP_REFRESERVATION), &refresrv, NULL);
- error = error ? error : dsl_prop_get_integer(zv->zv_name,
- zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &vbs, NULL);
- if (version >= SPA_VERSION_DEDUP) {
- error = error ? error :
- dsl_prop_get_integer(zv->zv_name,
- zfs_prop_to_name(ZFS_PROP_DEDUP), &dedup, NULL);
- }
-
- error = error ? error : zap_update(os, ZVOL_ZAP_OBJ,
+ error = zap_update(os, ZVOL_ZAP_OBJ,
zfs_prop_to_name(ZFS_PROP_COMPRESSION), 8, 1,
&compress, tx);
- error = error ? error : zap_update(os, ZVOL_ZAP_OBJ,
- zfs_prop_to_name(ZFS_PROP_CHECKSUM), 8, 1, &checksum, tx);
- error = error ? error : zap_update(os, ZVOL_ZAP_OBJ,
- zfs_prop_to_name(ZFS_PROP_REFRESERVATION), 8, 1,
- &refresrv, tx);
- error = error ? error : zap_update(os, ZVOL_ZAP_OBJ,
- zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), 8, 1,
- &vbs, tx);
- error = error ? error : dmu_object_set_blocksize(
- os, ZVOL_OBJ, SPA_OLD_MAXBLOCKSIZE, 0, tx);
- if (version >= SPA_VERSION_DEDUP) {
- error = error ? error : zap_update(os, ZVOL_ZAP_OBJ,
+ if (error == 0) {
+ error = zap_update(os, ZVOL_ZAP_OBJ,
+ zfs_prop_to_name(ZFS_PROP_CHECKSUM), 8, 1,
+ &checksum, tx);
+ }
+ if (error == 0) {
+ error = zap_update(os, ZVOL_ZAP_OBJ,
+ zfs_prop_to_name(ZFS_PROP_REFRESERVATION), 8, 1,
+ &refresrv, tx);
+ }
+ if (error == 0) {
+ error = zap_update(os, ZVOL_ZAP_OBJ,
+ zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), 8, 1,
+ &vbs, tx);
+ }
+ if (error == 0) {
+ error = dmu_object_set_blocksize(
+ os, ZVOL_OBJ, SPA_OLD_MAXBLOCKSIZE, 0, tx);
+ }
+ if (version >= SPA_VERSION_DEDUP && error == 0) {
+ error = zap_update(os, ZVOL_ZAP_OBJ,
zfs_prop_to_name(ZFS_PROP_DEDUP), 8, 1,
&dedup, tx);
}
* We only need update the zvol's property if we are initializing
* the dump area for the first time.
*/
- if (!resize) {
+ if (error == 0 && !resize) {
+ /*
+ * If MULTI_VDEV_CRASH_DUMP is active, use the NOPARITY checksum
+ * function. Otherwise, use the old default -- OFF.
+ */
+ checksum = spa_feature_is_active(spa,
+ SPA_FEATURE_MULTI_VDEV_CRASH_DUMP) ? ZIO_CHECKSUM_NOPARITY :
+ ZIO_CHECKSUM_OFF;
+
VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
VERIFY(nvlist_add_uint64(nv,
zfs_prop_to_name(ZFS_PROP_REFRESERVATION), 0) == 0);
error = zfs_set_prop_nvlist(zv->zv_name, ZPROP_SRC_LOCAL,
nv, NULL);
nvlist_free(nv);
-
- if (error)
- return (error);
}
/* Allocate the space for the dump */
- error = zvol_prealloc(zv);
+ if (error == 0)
+ error = zvol_prealloc(zv);
return (error);
}