Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by mlels...



details:   https://anonhg.NetBSD.org/src/rev/8e8fa582673f
branches:  netbsd-8
changeset: 435308:8e8fa582673f
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Oct 13 17:21:51 2018 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #1059):

        sys/dev/vnd.c: revision 1.265
        sys/dev/vndvar.h: revision 1.37

getdisksize only operates on device vnodes. Use the ioctl on the underlying
device instead.

diffstat:

 sys/dev/vnd.c    |  25 +++++++++++++++----------
 sys/dev/vndvar.h |   3 ++-
 2 files changed, 17 insertions(+), 11 deletions(-)

diffs (76 lines):

diff -r d0bb88db76eb -r 8e8fa582673f sys/dev/vnd.c
--- a/sys/dev/vnd.c     Sat Oct 13 17:19:05 2018 +0000
+++ b/sys/dev/vnd.c     Sat Oct 13 17:21:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.259.6.3 2018/10/13 17:19:05 martin Exp $     */
+/*     $NetBSD: vnd.c,v 1.259.6.4 2018/10/13 17:21:51 martin Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.259.6.3 2018/10/13 17:19:05 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.259.6.4 2018/10/13 17:21:51 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -575,20 +575,18 @@
            vnode_has_op(vnd->sc_vp, VOFFSET(vop_strategy));
 }
 
+/* Verify that I/O requests cannot be smaller than the
+ * smallest I/O size supported by the backend.
+ */
 static bool
 vnode_has_large_blocks(struct vnd_softc *vnd)
 {
-       u_int32_t vnd_secsize, mnt_secsize;
-       uint64_t numsec;
-       unsigned secsize;
+       u_int32_t vnd_secsize, iosize;
 
-       if (getdisksize(vnd->sc_vp, &numsec, &secsize))
-               return true;
-
+       iosize = vnd->sc_iosize;
        vnd_secsize = vnd->sc_geom.vng_secsize;
-       mnt_secsize = secsize;
 
-       return vnd_secsize % mnt_secsize != 0;
+       return vnd_secsize % iosize != 0;
 }
 
 /* XXX this function needs a reliable check to detect
@@ -1406,6 +1404,13 @@
                vnd->sc_vp = nd.ni_vp;
                vnd->sc_size = btodb(vattr.va_size);    /* note truncation */
 
+               /* get smallest I/O size for underlying device, fall back to
+                * fundamental I/O size of underlying filesystem
+                */
+               error = bdev_ioctl(vattr.va_fsid, DIOCGSECTORSIZE, &vnd->sc_iosize, FKIOCTL, l);
+               if (error)
+                       vnd->sc_iosize = vnd->sc_vp->v_mount->mnt_stat.f_frsize;
+
                /*
                 * Use pseudo-geometry specified.  If none was provided,
                 * use "standard" Adaptec fictitious geometry.
diff -r d0bb88db76eb -r 8e8fa582673f sys/dev/vndvar.h
--- a/sys/dev/vndvar.h  Sat Oct 13 17:19:05 2018 +0000
+++ b/sys/dev/vndvar.h  Sat Oct 13 17:21:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vndvar.h,v 1.35 2015/09/06 06:00:59 dholland Exp $     */
+/*     $NetBSD: vndvar.h,v 1.35.10.1 2018/10/13 17:21:51 martin Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -111,6 +111,7 @@
        int              sc_flags;      /* flags */
        uint64_t         sc_size;       /* size of vnd */
        struct vnode    *sc_vp;         /* vnode */
+       u_int            sc_iosize;     /* smallest I/O size for backend */
        kauth_cred_t     sc_cred;       /* credentials */
        int              sc_maxactive;  /* max # of active requests */
        struct bufq_state *sc_tab;      /* transfer queue */



Home | Main Index | Thread Index | Old Index