Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/dev/raidframe pull up rev 1.20 from trunk (requeste...



details:   https://anonhg.NetBSD.org/src/rev/bef842984c0f
branches:  netbsd-1-4
changeset: 469487:bef842984c0f
user:      cgd <cgd%NetBSD.org@localhost>
date:      Sun Sep 26 02:14:17 1999 +0000

description:
pull up rev 1.20 from trunk (requested by oster):
  Add a more reasonable throttling mechanism to the RAIDframe code.
  Increases write performance, and helps prevent the I/O routines from
  using too much kernel memory.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  39 ++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 10 deletions(-)

diffs (79 lines):

diff -r e302d66ac87d -r bef842984c0f sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sun Sep 26 02:11:25 1999 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sun Sep 26 02:14:17 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.16.2.3 1999/06/23 14:45:07 perry Exp $    */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.16.2.4 1999/09/26 02:14:17 cgd Exp $      */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -268,6 +268,16 @@
 #define        raidunit(x)     DISKUNIT(x)
 static int numraid = 0;
 
+/* 
+ * Allow RAIDOUTSTANDING number of simultaneous IO's to this RAID device. 
+ * Be aware that large numbers can allow the driver to consume a lot of 
+ * kernel memory, especially on writes... 
+ */
+
+#ifndef RAIDOUTSTANDING
+#define RAIDOUTSTANDING   10
+#endif
+
 #define RAIDLABELDEV(dev)      \
        (MAKEDISKDEV(major((dev)), raidunit((dev)), RAW_PART))
 
@@ -790,8 +800,11 @@
                /* configure the system */
 
                raidPtrs[unit]->raidid = unit;
+
                retcode = rf_Configure(raidPtrs[unit], k_cfg);
 
+               /* allow this many simultaneous IO's to this RAID device */
+               raidPtrs[unit]->openings = RAIDOUTSTANDING;
 
                if (retcode == 0) {
                        retcode = raidinit(dev, raidPtrs[unit], unit);
@@ -1476,12 +1489,24 @@
        }
        db1_printf(("Calling DoAccess..\n"));
 
+
+       /* Put a throttle on the number of requests we handle simultanously */
+
+       RF_LOCK_MUTEX(raidPtr->mutex);
+
+       while(raidPtr->openings <= 0) {
+               RF_UNLOCK_MUTEX(raidPtr->mutex);
+               (void)tsleep(&raidPtr->openings, PRIBIO, "rfdwait", 0);
+               RF_LOCK_MUTEX(raidPtr->mutex);
+       }
+       raidPtr->openings--;
+
+       RF_UNLOCK_MUTEX(raidPtr->mutex);
+
        /*
-        * XXX For now, all writes are sync
+        * Everything is async.
         */
        do_async = 1;
-       if ((bp->b_flags & B_READ) == 0)
-               do_async = 0;
 
        /* don't ever condition on bp->b_flags & B_WRITE.  always condition on
         * B_READ instead */
@@ -1496,12 +1521,6 @@
                bp->b_data, (int) bp->b_resid));
 #endif
 
-       /*
-        * If we requested sync I/O, sleep here.
-        */
-       if ((retcode == 0) && (do_async == 0))
-               tsleep(bp, PRIBIO, "raidsyncio", 0);
-
        return (retcode);
 }
 /* invoke an I/O from kernel mode.  Disk queue should be locked upon entry */



Home | Main Index | Thread Index | Old Index