Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen Add and use xbdminphys() to handle transfer...



details:   https://anonhg.NetBSD.org/src/rev/7ee78056f804
branches:  trunk
changeset: 777497:7ee78056f804
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Tue Feb 21 01:47:50 2012 +0000

description:
Add and use xbdminphys() to handle transfer segmentation/size limit.
Should allow us to use a normal MAXPHYS in domU kernels.

diffstat:

 sys/arch/xen/xen/xbd_xenbus.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r 26287672c685 -r 7ee78056f804 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c     Tue Feb 21 01:41:09 2012 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c     Tue Feb 21 01:47:50 2012 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.53 2012/02/02 20:11:26 para Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.54 2012/02/21 01:47:50 jakllsch Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.53 2012/02/02 20:11:26 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.54 2012/02/21 01:47:50 jakllsch Exp $");
 
 #include "opt_xen.h"
 
@@ -176,6 +176,8 @@
 static int  xbd_map_align(struct xbd_req *);
 static void xbd_unmap_align(struct xbd_req *);
 
+static void xbdminphys(struct buf *);
+
 CFATTACH_DECL3_NEW(xbd, sizeof(struct xbd_xenbus_softc),
     xbd_xenbus_match, xbd_xenbus_attach, xbd_xenbus_detach, NULL, NULL, NULL,
     DVF_DETACH_SHUTDOWN);
@@ -213,7 +215,7 @@
 
 static struct dkdriver xbddkdriver = {
         .d_strategy = xbdstrategy,
-       .d_minphys = minphys,
+       .d_minphys = xbdminphys,
 };
 
 static int
@@ -731,6 +733,15 @@
        return 1;
 }
 
+static void
+xbdminphys(struct buf *bp)
+{
+       if (bp->b_bcount > (PAGE_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST)) {
+               bp->b_bcount = PAGE_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST;
+       }
+       minphys(bp);
+}
+
 int
 xbdopen(dev_t dev, int flags, int fmt, struct lwp *l)
 {
@@ -805,7 +816,7 @@
 
        if ((dksc->sc_flags & DKF_INITED) == 0)
                return ENXIO;
-       return physio(xbdstrategy, NULL, dev, B_READ, minphys, uio);
+       return physio(xbdstrategy, NULL, dev, B_READ, xbdminphys, uio);
 }
 
 int
@@ -819,7 +830,7 @@
                return ENXIO;
        if (__predict_false(sc->sc_info & VDISK_READONLY))
                return EROFS;
-       return physio(xbdstrategy, NULL, dev, B_WRITE, minphys, uio);
+       return physio(xbdstrategy, NULL, dev, B_WRITE, xbdminphys, uio);
 }
 
 int



Home | Main Index | Thread Index | Old Index