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 provide d_iosize hook to cap the xfer size ...



details:   https://anonhg.NetBSD.org/src/rev/8258bdb9d79a
branches:  trunk
changeset: 1009157:8258bdb9d79a
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Apr 14 09:27:28 2020 +0000

description:
provide d_iosize hook to cap the xfer size used for dumps

diffstat:

 sys/arch/xen/xen/xbd_xenbus.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r bde03c4e3f13 -r 8258bdb9d79a sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c     Tue Apr 14 08:21:59 2020 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c     Tue Apr 14 09:27:28 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.109 2020/04/14 09:27:28 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.109 2020/04/14 09:27:28 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -176,6 +176,7 @@
 
 static int  xbd_handler(void *);
 static int  xbd_diskstart(device_t, struct buf *);
+static void xbd_iosize(device_t, int *);
 static void xbd_backend_changed(void *, XenbusState);
 static void xbd_connect(struct xbd_xenbus_softc *);
 
@@ -231,6 +232,7 @@
        .d_open = xbdopen,
        .d_close = xbdclose,
        .d_diskstart = xbd_diskstart,
+       .d_iosize = xbd_iosize,
 };
 
 static int
@@ -775,6 +777,17 @@
        minphys(bp);
 }
 
+static void
+xbd_iosize(device_t dev, int *maxxfer)
+{
+       /*
+        * Always restrict dumps to XBD_MAX_XFER to avoid indirect segments,
+        * so that it uses as little memory as possible. 
+        */
+       if (*maxxfer > XBD_MAX_XFER)
+               *maxxfer = XBD_MAX_XFER;
+}
+
 int
 xbdopen(dev_t dev, int flags, int fmt, struct lwp *l)
 {



Home | Main Index | Thread Index | Old Index