diff options
author | delphij <delphij@FreeBSD.org> | 2014-10-20 21:59:11 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2014-10-20 21:59:11 +0000 |
commit | cc4935ee8d2181a8175653328508096879963893 (patch) | |
tree | 7b719776f1c61e4b9c91ade5950b052341f2bccc /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c | |
parent | ac9149e73f8a61253bb7362405974c8a649ef34c (diff) | |
download | FreeBSD-src-cc4935ee8d2181a8175653328508096879963893.zip FreeBSD-src-cc4935ee8d2181a8175653328508096879963893.tar.gz |
MFC r272510: MFV r272498:
Add a new sysctl, vfs.zfs.vol.unmap_enabled, which allows the system
administrator to toggle whether ZFS should ignore UNMAP requests.
Illumos issue:
5149 zvols need a way to ignore DKIOCFREE
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c index ab7d50f..4c67f2f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -168,6 +168,14 @@ static LIST_HEAD(, zvol_state) all_zvols; */ int zvol_maxphys = DMU_MAX_ACCESS/2; +/* + * Toggle unmap functionality. + */ +boolean_t zvol_unmap_enabled = B_TRUE; +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN, + &zvol_unmap_enabled, 0, + "Enable UNMAP functionality"); + static d_open_t zvol_d_open; static d_close_t zvol_d_close; static d_read_t zvol_read; @@ -1972,6 +1980,9 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) dkioc_free_t df; dmu_tx_t *tx; + if (!zvol_unmap_enabled) + break; + if (ddi_copyin((void *)arg, &df, sizeof (df), flag)) { error = SET_ERROR(EFAULT); break; @@ -2816,6 +2827,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct threa zil_commit(zv->zv_zilog, ZVOL_OBJ); break; case DIOCGDELETE: + if (!zvol_unmap_enabled) + break; + offset = ((off_t *)data)[0]; length = ((off_t *)data)[1]; if ((offset % DEV_BSIZE) != 0 || (length % DEV_BSIZE) != 0 || |