Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Try to retrieve t...



details:   https://anonhg.NetBSD.org/src/rev/e88a4adcc782
branches:  trunk
changeset: 451893:e88a4adcc782
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Jun 11 09:04:37 2019 +0000

description:
Try to retrieve the per-disk maximum transfer size and use it instead
of MAXPHYS.  Eagerly waiting for the merge of tls-maxphys.

Addresses PR port-xen/54273: "zpool create pool xbd2" panics DOMU kernel

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h |   1 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c     |  26 ++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diffs (68 lines):

diff -r c1d6b757e45a -r e88a4adcc782 external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h        Tue Jun 11 08:34:01 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h        Tue Jun 11 09:04:37 2019 +0000
@@ -52,6 +52,7 @@
        char            *vd_minor;
        vnode_t         *vd_vp;
        struct workqueue *vd_wq;
+       int             vd_maxphys;
 #endif
 } vdev_disk_t;
 #endif
diff -r c1d6b757e45a -r e88a4adcc782 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Tue Jun 11 08:34:01 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Tue Jun 11 09:04:37 2019 +0000
@@ -219,6 +219,27 @@
                return (SET_ERROR(EINVAL));
        }
 
+       /* XXXNETBSD Once tls-maxphys gets merged this block becomes:
+               pdk = disk_find_blk(vp->v_rdev);
+               dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
+       */
+       {
+               struct buf buf = { b_bcount: MAXPHYS };
+               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);
+                       if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
+                               (*pdk->dk_driver->d_minphys)(&buf);
+               }
+               dvd->vd_maxphys = buf.b_bcount;
+       }
+
        /*
         * XXXNETBSD Compare the devid to the stored value.
         */
@@ -421,6 +442,7 @@
                zio_interrupt(zio);
                return;
        }
+       ASSERT3U(dvd->vd_maxphys, >, 0);
        vp = dvd->vd_vp;
 #endif
 
@@ -473,7 +495,7 @@
                mutex_exit(vp->v_interlock);
        }
 
-       if (bp->b_bcount <= MAXPHYS) {
+       if (bp->b_bcount <= dvd->vd_maxphys) {
                /* We can do this I/O in one pass. */
                (void)VOP_STRATEGY(vp, bp);
        } else {
@@ -484,7 +506,7 @@
                resid = zio->io_size;
                off = 0;
                while (resid != 0) {
-                       size = uimin(resid, MAXPHYS);
+                       size = uimin(resid, dvd->vd_maxphys);
                        nbp = getiobuf(vp, true);
                        nbp->b_blkno = btodb(zio->io_offset + off);
                        /* Below call increments v_numoutput. */



Home | Main Index | Thread Index | Old Index