svn commit: r289190 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Alexander Motin
mav at FreeBSD.org
Mon Oct 12 15:39:05 UTC 2015
Author: mav
Date: Mon Oct 12 15:39:03 2015
New Revision: 289190
URL: https://svnweb.freebsd.org/changeset/base/289190
Log:
MFV r289185: 6250 zvol_dump_init() can hold txg open
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Prakash Surya <prakash.surya at delphix.com>
Reviewed by: Albert Lee <trisk at omniti.com>
Reviewed by: Xin Li <delphij at freebsd.org>
Approved by: Garrett D'Amore <garrett at damore.org>
Author: George Wilson <george.wilson at delphix.com>
illumos/illumos-gate at b10bba72460aeaa53119c76ff5e647fd5585bece
Modified:
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
head/sys/cddl/contrib/opensolaris/ (props changed)
Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 12 15:35:34 2015 (r289189)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 12 15:39:03 2015 (r289190)
@@ -2335,13 +2335,15 @@ zvol_dump_init(zvol_state_t *zv, boolean
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);
@@ -2365,24 +2367,42 @@ zvol_dump_init(zvol_state_t *zv, boolean
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
* zvolsize. Otherwise, we save off the original state of the
@@ -2393,37 +2413,30 @@ zvol_dump_init(zvol_state_t *zv, boolean
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);
}
@@ -2436,7 +2449,15 @@ zvol_dump_init(zvol_state_t *zv, boolean
* 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);
@@ -2455,13 +2476,11 @@ zvol_dump_init(zvol_state_t *zv, boolean
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);
}
More information about the svn-src-all
mailing list