Date: Sat, 4 Oct 2014 08:51:57 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272510 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <201410040851.s948pviu022065@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Sat Oct 4 08:51:57 2014 New Revision: 272510 URL: https://svnweb.freebsd.org/changeset/base/272510 Log: 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 MFC after: 2 weeks 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 Sat Oct 4 08:41:23 2014 (r272509) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Oct 4 08:51:57 2014 (r272510) @@ -167,6 +167,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; @@ -1971,6 +1979,9 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 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; @@ -2815,6 +2826,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cm 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 ||
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410040851.s948pviu022065>