Index: external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
===================================================================
RCS file: /cvsroot/src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c,v
retrieving revision 1.13
diff -p -u -r1.13 vdev_disk.c
--- external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	1 Dec 2019 20:25:31 -0000	1.13
+++ external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	28 Feb 2020 07:25:52 -0000
@@ -35,7 +35,6 @@
 #include <sys/sunldi.h>
 #include <sys/fm/fs/zfs.h>
 #include <sys/disk.h>
-#include <sys/disklabel.h>
 #include <sys/dkio.h>
 #include <sys/workqueue.h>
 
@@ -147,10 +146,11 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 	spa_t *spa = vd->vdev_spa;
 	vdev_disk_t *dvd;
 	vnode_t *vp;
-	struct dkwedge_info dkw;
-	struct disk *pdk;
 	int error, cmd;
-	struct partinfo pinfo;
+	uint64_t numsecs;
+	unsigned secsize;
+	struct disk *pdk;
+	struct dkwedge_info dkw;
 
 	/*
 	 * We must have a pathname, and it must be absolute.
@@ -219,33 +219,15 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 		return (SET_ERROR(EINVAL));
 	}
 
+	pdk = NULL;
+	if (getdiskinfo(vp, &dkw) == 0)
+		pdk = disk_find(dkw.dkw_parent);
+
 	/* XXXNETBSD Once tls-maxphys gets merged this block becomes:
-		if (VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED) == 0)
-			pdk = disk_find(dkw.dkw_parent);
-		else
-			pdk = disk_find_blk(vp->v_rdev);
 		dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
 	*/
 	{
 		struct buf buf = { .b_bcount = MAXPHYS };
-
-		if (VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED) == 0) {
-			pdk = disk_find(dkw.dkw_parent);
-		} else {
-			const char *dev_name;
-
-			dev_name = devsw_blk2name(major(vp->v_rdev));
-			if (dev_name) {
-				char disk_name[16];
-
-				snprintf(disk_name, sizeof(disk_name), "%s%d",
-				    dev_name, DISKUNIT(vp->v_rdev));
-				pdk = disk_find(disk_name);
-			} else {
-				pdk = NULL;
-			}
-			buf.b_dev = vp->v_rdev;
-		}
 		if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
 			(*pdk->dk_driver->d_minphys)(&buf);
 		dvd->vd_maxphys = buf.b_bcount;
@@ -268,32 +250,22 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 	dvd->vd_vp = vp;
 
 skip_open:
-	/*
-	 * Determine the actual size of the device.
-	 * Try wedge info first as it supports larger disks.
-	 */
-	error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED);
-	if (error == 0) {
-		pdk = disk_find(dkw.dkw_parent);
-		if (pdk) {
-			pinfo.pi_secsize = (1 << pdk->dk_byteshift);
-			pinfo.pi_size = dkw.dkw_size;
-			pinfo.pi_offset = dkw.dkw_offset;
-		} else	
-			error = ENODEV;
-	}
-	if (error)
-		error = VOP_IOCTL(vp, DIOCGPARTINFO, &pinfo, FREAD, kcred);
+	error = getdisksize(vp, &numsecs, &secsize);
 	if (error != 0) {
 		vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
 		return (SET_ERROR(error));
 	}
-	*psize = pinfo.pi_size * pinfo.pi_secsize;
+
+	*psize = numsecs * secsize;
 	*max_psize = *psize;
 
-	*ashift = highbit(MAX(pinfo.pi_secsize, SPA_MINBLOCKSIZE)) - 1;
+	*ashift = highbit(MAX(secsize, SPA_MINBLOCKSIZE)) - 1;
 	*pashift = *ashift;
-	vd->vdev_wholedisk = (pinfo.pi_offset == 0); /* XXXNETBSD */
+
+	vd->vdev_wholedisk = 0;
+	if (getdiskinfo(vp, &dkw) != 0 &&
+	    dkw.dkw_offset == 0 && dkw.dkw_size == numsecs)
+		vd->vdev_wholedisk = 1,
 
 	/*
 	 * Clear the nowritecache bit, so that on a vdev_reopen() we will
Index: sys/kern/subr_disk_open.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_disk_open.c,v
retrieving revision 1.14
diff -p -u -r1.14 subr_disk_open.c
--- sys/kern/subr_disk_open.c	20 Feb 2019 10:02:51 -0000	1.14
+++ sys/kern/subr_disk_open.c	28 Feb 2020 07:25:52 -0000
@@ -154,9 +154,8 @@ getdiskinfo(struct vnode *vp, struct dkw
 	if ((error = VOP_IOCTL(vp, DIOCGPARTINFO, &pi, FREAD, NOCRED)) != 0)
 		return error;
 
-	snprintf(dkw->dkw_devname, sizeof(dkw->dkw_devname), "%s%" PRId32 "%c",
-	    devsw_blk2name(major(dev)), DISKUNIT(dev), (char)DISKPART(dev) +
-	    'a');
+	snprintf(dkw->dkw_devname, sizeof(dkw->dkw_devname), "%s%" PRId32,
+	    devsw_blk2name(major(dev)), DISKUNIT(dev));
 
 	dkw->dkw_wname[0] = '\0';
 
