7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
illumos/illumos-gate@1c9272b861
1c9272b861
https://www.illumos.org/issues/7570
Based on the discovery that every unmap waits for the commit of the txn to the ZIL,
introducing a very high latency to unmap commands, this behavior was made into a
tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is
that by default SCSI unmap commands will result in space being freed within the zvol
(today they are ignored and returned with good status). However, unlike the code
today, instead of 18+ms per unmap, they take about 30us.
With the testing done on NTFS against a Win2k12 target, the new behavior should work
seamlessly. Files on the zvol that have already been set with the zfree application
will continue to write 0's when deleted, and any new files created since zvol
creation will send unmap commands when deleted. This behavior exists today, but with
this change the unmap commands will be processed and result in reclaim of space.
Author: Stephen Blinick <stephen.blinick@delphix.com>
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>
This commit is contained in:
parent
acf1cb602b
commit
dbac7ab9c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/illumos/dist/; revision=314276
@ -24,7 +24,7 @@
|
|||||||
* Portions Copyright 2010 Robert Milkowski
|
* Portions Copyright 2010 Robert Milkowski
|
||||||
*
|
*
|
||||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
* 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) 2013, Joyent, Inc. All rights reserved.
|
||||||
* Copyright (c) 2014 Integros [integros.com]
|
* Copyright (c) 2014 Integros [integros.com]
|
||||||
*/
|
*/
|
||||||
@ -148,6 +148,12 @@ int zvol_maxphys = DMU_MAX_ACCESS/2;
|
|||||||
*/
|
*/
|
||||||
boolean_t zvol_unmap_enabled = B_TRUE;
|
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,
|
extern int zfs_set_prop_nvlist(const char *, zprop_source_t,
|
||||||
nvlist_t *, nvlist_t *);
|
nvlist_t *, nvlist_t *);
|
||||||
static int zvol_remove_zv(zvol_state_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);
|
zfs_range_unlock(rl);
|
||||||
|
|
||||||
if (error == 0) {
|
/*
|
||||||
/*
|
* If the write-cache is disabled, 'sync' property
|
||||||
* If the write-cache is disabled or 'sync' property
|
* is set to 'always', or if the caller is asking for
|
||||||
* is set to 'always' then treat this as a synchronous
|
* a synchronous free, commit this operation to the zil.
|
||||||
* operation (i.e. commit to zil).
|
* This will sync any previous uncommitted writes to the
|
||||||
*/
|
* zvol object.
|
||||||
if (!(zv->zv_flags & ZVOL_WCE) ||
|
* Can be overridden by the zvol_unmap_sync_enabled tunable.
|
||||||
(zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS))
|
*/
|
||||||
zil_commit(zv->zv_zilog, ZVOL_OBJ);
|
if ((error == 0) && zvol_unmap_sync_enabled &&
|
||||||
|
(!(zv->zv_flags & ZVOL_WCE) ||
|
||||||
/*
|
(zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) ||
|
||||||
* If the caller really wants synchronous writes, and
|
(df.df_flags & DF_WAIT_SYNC))) {
|
||||||
* can't wait for them, don't return until the write
|
zil_commit(zv->zv_zilog, ZVOL_OBJ);
|
||||||
* is done.
|
|
||||||
*/
|
|
||||||
if (df.df_flags & DF_WAIT_SYNC) {
|
|
||||||
txg_wait_synced(
|
|
||||||
dmu_objset_pool(zv->zv_objset), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user