summaryrefslogtreecommitdiff
path: root/usr/src/uts/common
diff options
context:
space:
mode:
authorGeorge Wilson <george.wilson@delphix.com>2016-07-13 17:07:06 -0700
committerMatthew Ahrens <mahrens@delphix.com>2016-07-14 12:11:34 -0700
commit470bc2d6d44a4a70ed9403c0bce321333e897c31 (patch)
tree2ca1fb706171a910d9dced3eac46f6c15bc4c050 /usr/src/uts/common
parent25f7d993adbfb3452ac4625b3791670746d35ae3 (diff)
downloadillumos-joyent-470bc2d6d44a4a70ed9403c0bce321333e897c31.tar.gz
6327 devfsadm and bootadm taking long time for configs with large number of zvols
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Sebastien Roy <sebastien.roy@delphix.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r--usr/src/uts/common/fs/dev/sdev_zvolops.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/usr/src/uts/common/fs/dev/sdev_zvolops.c b/usr/src/uts/common/fs/dev/sdev_zvolops.c
index 11384e33d3..f75d5c3c4e 100644
--- a/usr/src/uts/common/fs/dev/sdev_zvolops.c
+++ b/usr/src/uts/common/fs/dev/sdev_zvolops.c
@@ -22,6 +22,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2013, 2016 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014 by Delphix. All rights reserved.
*/
/* vnode ops for the /dev/zvol directory */
@@ -64,6 +65,13 @@ ddi_modhandle_t zfs_mod;
int (*szcm)(char *);
int (*szn2m)(char *, minor_t *);
+
+/*
+ * Enable/disable snapshots from being created in /dev/zvol. By default,
+ * they are enabled, preserving the historic behavior.
+ */
+boolean_t devzvol_snaps_allowed = B_TRUE;
+
int
sdev_zvol_create_minor(char *dsname)
{
@@ -172,12 +180,18 @@ again:
int
devzvol_objset_check(char *dsname, dmu_objset_type_t *type)
{
- boolean_t ispool;
+ boolean_t ispool, is_snapshot;
zfs_cmd_t *zc;
int rc;
nvlist_t *nvl;
size_t nvsz;
+ ispool = (strchr(dsname, '/') == NULL);
+ is_snapshot = (strchr(dsname, '@') != NULL);
+
+ if (is_snapshot && !devzvol_snaps_allowed)
+ return (ENOTSUP);
+
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
(void) strlcpy(zc->zc_name, dsname, MAXPATHLEN);
@@ -187,7 +201,6 @@ devzvol_objset_check(char *dsname, dmu_objset_type_t *type)
zc->zc_nvlist_src_size = nvsz;
fnvlist_free(nvl);
- ispool = (strchr(dsname, '/') == NULL) ? B_TRUE : B_FALSE;
rc = devzvol_handle_ioctl(ispool ? ZFS_IOC_POOL_STATS :
ZFS_IOC_OBJSET_STATS, zc, NULL);
if (type && rc == 0)
@@ -863,7 +876,8 @@ sdev_iter_datasets(struct vnode *dvp, int arg, char *name)
goto skip;
}
if (arg == ZFS_IOC_DATASET_LIST_NEXT &&
- zc->zc_objset_stats.dds_type != DMU_OST_ZFS)
+ zc->zc_objset_stats.dds_type == DMU_OST_ZVOL &&
+ devzvol_snaps_allowed)
sdev_iter_snapshots(dvp, zc->zc_name);
skip:
(void) strcpy(zc->zc_name, name);