Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Once upon a time, long long ago, there was...



details:   https://anonhg.NetBSD.org/src/rev/3fd48b5ace66
branches:  trunk
changeset: 474475:3fd48b5ace66
user:      oster <oster%NetBSD.org@localhost>
date:      Thu Jul 08 00:45:23 1999 +0000

description:
Once upon a time, long long ago, there was a "fix" added to the
RAIDframe driver to stop it from eating too much kernel memory when
writing data.  But that fix had a nasty side-affect of hurting write
performance (*much* more than I thought it would).  These changes nuke
that "fix", and instead put in a more reasonable mechanism for limiting
the number of simultaneous IO's which can be happening for each RAID device.
The result is a noticeable improvement in write throughput.  The End.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  39 ++++++++++++++++++++++++++++---------
 sys/dev/raidframe/rf_raid.h        |   7 +++++-
 sys/dev/raidframe/rf_states.c      |  12 ++++++++++-
 3 files changed, 46 insertions(+), 12 deletions(-)

diffs (126 lines):

diff -r 4dcb6750e38e -r 3fd48b5ace66 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Thu Jul 08 00:41:21 1999 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Thu Jul 08 00:45:23 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.19 1999/06/13 20:36:17 oster Exp $        */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.20 1999/07/08 00:45:23 oster 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 */
diff -r 4dcb6750e38e -r 3fd48b5ace66 sys/dev/raidframe/rf_raid.h
--- a/sys/dev/raidframe/rf_raid.h       Thu Jul 08 00:41:21 1999 +0000
+++ b/sys/dev/raidframe/rf_raid.h       Thu Jul 08 00:45:23 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_raid.h,v 1.5 1999/03/02 03:18:49 oster Exp $        */
+/*     $NetBSD: rf_raid.h,v 1.6 1999/07/08 00:45:24 oster Exp $        */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -136,6 +136,11 @@
        int     serial_number;  /* a "serial number" for this set */
        int     mod_counter;    /* modification counter for component labels */
        int     clean;          /* the clean bit for this array. */
+
+       int     openings;       /* Number of IO's which can be scheduled
+                                  simultaneously (high-level - not a 
+                                  per-component limit)*/
+
        /*
          * Cleanup stuff
          */
diff -r 4dcb6750e38e -r 3fd48b5ace66 sys/dev/raidframe/rf_states.c
--- a/sys/dev/raidframe/rf_states.c     Thu Jul 08 00:41:21 1999 +0000
+++ b/sys/dev/raidframe/rf_states.c     Thu Jul 08 00:45:23 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_states.c,v 1.6 1999/02/05 00:06:17 oster Exp $      */
+/*     $NetBSD: rf_states.c,v 1.7 1999/07/08 00:45:24 oster Exp $      */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -217,6 +217,16 @@
                if (desc->async_flag == 0)
                        wakeup(desc->bp);
 
+               /* 
+                * Wakeup any requests waiting to go.
+                */
+
+               RF_LOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
+               ((RF_Raid_t *) desc->raidPtr)->openings++;
+               wakeup(&(((RF_Raid_t *) desc->raidPtr)->openings));
+               RF_UNLOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
+
+
                /* printf("Calling biodone on 0x%x\n",desc->bp); */
                biodone(desc->bp);      /* access came through ioctl */
        }



Home | Main Index | Thread Index | Old Index