[CFR][ZFS] Use vdev_path instead of vdev_physpath in sysevent

Justin T. Gibbs gibbs at scsiguy.com
Tue Jun 14 21:58:54 UTC 2011


In spa_async_autoexpand(), we can avoid the creation of a valid devfs name
(which is currently performed using Solaris' "/devices") by just using
the vdev_path.  Since the device is online, there is no benefit to using
the physical path location.  Further, the physical path data may include
prefix data (e.g. physical path quality) that will require more code to
strip out.

--
Justin

-------------- next part --------------
diff -u -r -x cscope.out -x out -x ctl -x compile vendor/FreeBSD/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c SpectraBSD/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
--- vendor/FreeBSD/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	2011-02-28 13:51:27.986816115 -0700
+++ SpectraBSD/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	2011-06-06 15:50:11.169668215 -0600
@@ -5051,7 +5067,6 @@
 {
 	sysevent_id_t eid;
 	nvlist_t *attr;
-	char *physpath;
 
 	if (!spa->spa_autoexpand)
 		return;
@@ -5061,20 +5076,16 @@
 		spa_async_autoexpand(spa, cvd);
 	}
 
-	if (!vd->vdev_ops->vdev_op_leaf || vd->vdev_physpath == NULL)
+	if (!vd->vdev_ops->vdev_op_leaf || vd->vdev_path == NULL)
 		return;
 
-	physpath = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
-	(void) snprintf(physpath, MAXPATHLEN, "/devices%s", vd->vdev_physpath);
-
 	VERIFY(nvlist_alloc(&attr, NV_UNIQUE_NAME, KM_SLEEP) == 0);
-	VERIFY(nvlist_add_string(attr, DEV_PHYS_PATH, physpath) == 0);
+	VERIFY(nvlist_add_string(attr, DEV_PATH, vd->vdev_path) == 0);
 
 	(void) ddi_log_sysevent(zfs_dip, SUNW_VENDOR, EC_DEV_STATUS,
 	    ESC_ZFS_VDEV_AUTOEXPAND, attr, &eid, DDI_SLEEP);
 
 	nvlist_free(attr);
-	kmem_free(physpath, MAXPATHLEN);
 }
 
 static void


More information about the freebsd-fs mailing list