summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorStephen Blinick <stephen.blinick@delphix.com>2016-11-18 11:34:16 -0800
committerMatthew Ahrens <mahrens@delphix.com>2016-11-18 20:49:33 -0800
commit1c9272b861cd640a8342f4407da026ed98615517 (patch)
tree7e1d9078296ee6b3f6be805780d44991d7a88975 /usr/src
parentb001165b0c3b957ada8be2307cb7337d3ae15871 (diff)
downloadillumos-joyent-1c9272b861cd640a8342f4407da026ed98615517.tar.gz
7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Matt Ahrens <mahrens@delphix.com> Reviewed by: Steve Gonczi <steve.gonczi@delphix.com> Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com> Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/fs/zfs/zvol.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/usr/src/uts/common/fs/zfs/zvol.c b/usr/src/uts/common/fs/zfs/zvol.c
index 95bb26c211..0742f86322 100644
--- a/usr/src/uts/common/fs/zfs/zvol.c
+++ b/usr/src/uts/common/fs/zfs/zvol.c
@@ -24,7 +24,7 @@
* Portions Copyright 2010 Robert Milkowski
*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
*/
@@ -148,6 +148,12 @@ int zvol_maxphys = DMU_MAX_ACCESS/2;
*/
boolean_t zvol_unmap_enabled = B_TRUE;
+/*
+ * If true, unmaps requested as synchronous are executed synchronously,
+ * otherwise all unmaps are asynchronous.
+ */
+boolean_t zvol_unmap_sync_enabled = B_FALSE;
+
extern int zfs_set_prop_nvlist(const char *, zprop_source_t,
nvlist_t *, nvlist_t *);
static int zvol_remove_zv(zvol_state_t *);
@@ -1811,26 +1817,21 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
zfs_range_unlock(rl);
- if (error == 0) {
- /*
- * If the write-cache is disabled or 'sync' property
- * is set to 'always' then treat this as a synchronous
- * operation (i.e. commit to zil).
- */
- if (!(zv->zv_flags & ZVOL_WCE) ||
- (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS))
- zil_commit(zv->zv_zilog, ZVOL_OBJ);
-
- /*
- * If the caller really wants synchronous writes, and
- * can't wait for them, don't return until the write
- * is done.
- */
- if (df.df_flags & DF_WAIT_SYNC) {
- txg_wait_synced(
- dmu_objset_pool(zv->zv_objset), 0);
- }
+ /*
+ * If the write-cache is disabled, 'sync' property
+ * is set to 'always', or if the caller is asking for
+ * a synchronous free, commit this operation to the zil.
+ * This will sync any previous uncommitted writes to the
+ * zvol object.
+ * Can be overridden by the zvol_unmap_sync_enabled tunable.
+ */
+ if ((error == 0) && zvol_unmap_sync_enabled &&
+ (!(zv->zv_flags & ZVOL_WCE) ||
+ (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) ||
+ (df.df_flags & DF_WAIT_SYNC))) {
+ zil_commit(zv->zv_zilog, ZVOL_OBJ);
}
+
return (error);
}