summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>1999-07-08 00:45:23 +0000
committeroster <oster@NetBSD.org>1999-07-08 00:45:23 +0000
commit324c76b3d9a47bc2f143742864a671b2eff01e28 (patch)
treeeecd9666d7a06d561f156562b13aa92d5d6a4b9c /sys/dev/raidframe
parent9c536f29668a3b8f099b3cdba6fe86a846c84ce1 (diff)
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 (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c39
-rw-r--r--sys/dev/raidframe/rf_raid.h7
-rw-r--r--sys/dev/raidframe/rf_states.c12
3 files changed, 46 insertions, 12 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index d8a75b0e7d6..0953868f2e6 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -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 @@ struct raid_softc {
#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 @@ raidioctl(dev, cmd, data, flag, p)
/* 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 @@ rf_DoAccessKernel(raidPtr, bp, flags, cbFunc, cbArg)
}
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 @@ rf_DoAccessKernel(raidPtr, bp, flags, cbFunc, cbArg)
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 --git a/sys/dev/raidframe/rf_raid.h b/sys/dev/raidframe/rf_raid.h
index 489d028e5d5..bb27422e414 100644
--- a/sys/dev/raidframe/rf_raid.h
+++ b/sys/dev/raidframe/rf_raid.h
@@ -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 @@ struct RF_Raid_s {
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 --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c
index 7328a3d171a..34b9a955d71 100644
--- a/sys/dev/raidframe/rf_states.c
+++ b/sys/dev/raidframe/rf_states.c
@@ -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 @@ rf_State_LastState(RF_RaidAccessDesc_t * desc)
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 */
}