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 Rearrange the eva...



details:   https://anonhg.NetBSD.org/src/rev/978b28c5e49c
branches:  trunk
changeset: 964860:978b28c5e49c
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Aug 20 08:12:14 2019 +0000

description:
Rearrange the evaluation of "dvd_maxphys" so it works for wedges too.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c |  30 ++++++++++++------
 1 files changed, 20 insertions(+), 10 deletions(-)

diffs (47 lines):

diff -r 91c2af11040c -r 978b28c5e49c external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Tue Aug 20 08:11:21 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Tue Aug 20 08:12:14 2019 +0000
@@ -220,23 +220,33 @@
        }
 
        /* XXXNETBSD Once tls-maxphys gets merged this block becomes:
-               pdk = disk_find_blk(vp->v_rdev);
+               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 };
-               const char *dev_name;
 
-               dev_name = devsw_blk2name(major(vp->v_rdev));
-               if (dev_name) {
-                       char disk_name[16];
+               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);
-                       if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
-                               (*pdk->dk_driver->d_minphys)(&buf);
+                               snprintf(disk_name, sizeof(disk_name), "%s%d",
+                                   dev_name, DISKUNIT(vp->v_rdev));
+                               pdk = disk_find(disk_name);
+                       } else {
+                               pdk = NULL;
+                       }
                }
+               if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
+                       (*pdk->dk_driver->d_minphys)(&buf);
                dvd->vd_maxphys = buf.b_bcount;
        }
 



Home | Main Index | Thread Index | Old Index