summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2004-03-20 04:22:05 +0000
committeroster <oster@NetBSD.org>2004-03-20 04:22:05 +0000
commit0ff214564803add4a3a9ef738c0dd02b41f2ff38 (patch)
tree5b812f74f0b9cee4b4fa44dae5b864947345022c /sys/dev/raidframe
parent068442743911ba78048d0658f611997a42661a9c (diff)
For each RAID set, pre-allocate a number of "emergency buffers" to be
used in the event that we can't malloc a buffer of the appropriate size in the traditional way. rf_AllocIOBuffer() and rf_FreeIOBuffer() deal with allocating/freeing these structures. These buffers are stored in a list on the 'iobuf' list. iobuf_count keeps track of how many buffers are available, and numEmergencyBuffers is the effective "high-water" mark for the freelist. The buffers allocated by rf_AllocIOBuffer() are stripe-unit sized, which is the maximum size requested by any of the callers. Add an iobufs entry to RF_DagHeader_s. Use it for keeping track of buffers that get allocated from the free-list. Add a "generic list" pool (VoidPointerListElement Pool) for elements used to maintain a list of allocated memory. [It is somewhat less than ideal to add another little pool to handle this...] Teach rf_AllocBuffer() to use the new rf_AllocIOBuffer(). Modify other Mallocs to use rf_AllocIOBuffer(), and to update dag_h->iobufs as appropriate. Update rf_FreeDAG() to handle cleanup of dag_h->iobufs. While here, add some missing pool_destroy() calls for a number of pools. With these changes, it should (in theory) be possible to swap on RAID 5 sets again. That said, I've not had any success there yet -- but the last issue I saw at least wasn't in RAIDframe. :-} [There is room for this code to become a bit more consise, but I wanted to do a checkpoint here with something known to work :) ]
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_dag.h4
-rw-r--r--sys/dev/raidframe/rf_dagdegwr.c12
-rw-r--r--sys/dev/raidframe/rf_dagffwr.c15
-rw-r--r--sys/dev/raidframe/rf_dagutils.c85
-rw-r--r--sys/dev/raidframe/rf_dagutils.h6
-rw-r--r--sys/dev/raidframe/rf_driver.c32
-rw-r--r--sys/dev/raidframe/rf_layout.h10
-rw-r--r--sys/dev/raidframe/rf_map.c32
-rw-r--r--sys/dev/raidframe/rf_map.h4
-rw-r--r--sys/dev/raidframe/rf_netbsd.h7
-rw-r--r--sys/dev/raidframe/rf_raid.h6
11 files changed, 186 insertions, 27 deletions
diff --git a/sys/dev/raidframe/rf_dag.h b/sys/dev/raidframe/rf_dag.h
index 064d7a0fb4e..38f9eac59e1 100644
--- a/sys/dev/raidframe/rf_dag.h
+++ b/sys/dev/raidframe/rf_dag.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dag.h,v 1.14 2004/03/19 17:01:26 oster Exp $ */
+/* $NetBSD: rf_dag.h,v 1.15 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -174,6 +174,8 @@ struct RF_DagHeader_s {
RF_DagNode_t *nodes; /* linked list of nodes used in this DAG */
RF_PhysDiskAddr_t *pda_cleanup_list; /* for PDAs that can't get
cleaned up any other way... */
+ RF_VoidPointerListElem_t *iobufs; /* iobufs that need to be cleaned up at
+ the end of this IO */
RF_Raid_t *raidPtr; /* the descriptor for the RAID device this DAG
* is for */
void *bp; /* the bp for this I/O passed down from the
diff --git a/sys/dev/raidframe/rf_dagdegwr.c b/sys/dev/raidframe/rf_dagdegwr.c
index afb7f87108e..24881fe77de 100644
--- a/sys/dev/raidframe/rf_dagdegwr.c
+++ b/sys/dev/raidframe/rf_dagdegwr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagdegwr.c,v 1.19 2004/03/19 15:16:18 oster Exp $ */
+/* $NetBSD: rf_dagdegwr.c,v 1.20 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.19 2004/03/19 15:16:18 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.20 2004/03/20 04:22:05 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -176,6 +176,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr,
RF_StripeNum_t parityStripeID;
RF_PhysDiskAddr_t *failedPDA;
RF_RaidLayout_t *layoutPtr;
+ RF_VoidPointerListElem_t *vple;
layoutPtr = &(raidPtr->Layout);
parityStripeID = rf_RaidAddressToParityStripeID(layoutPtr, asmap->raidAddress,
@@ -368,8 +369,11 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr,
parityPDA->numSector = failedPDA->numSector;
if (!xorTargetBuf) {
- RF_MallocAndAdd(xorTargetBuf,
- rf_RaidAddressToByte(raidPtr, failedPDA->numSector), (char *), allocList);
+ xorTargetBuf = rf_AllocIOBuffer(raidPtr, rf_RaidAddressToByte(raidPtr, failedPDA->numSector));
+ vple = rf_AllocVPListElem();
+ vple->p = xorTargetBuf;
+ vple->next = dag_h->iobufs;
+ dag_h->iobufs = vple;
}
/* init the Wnp node */
rf_InitNode(wnpNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
diff --git a/sys/dev/raidframe/rf_dagffwr.c b/sys/dev/raidframe/rf_dagffwr.c
index ba9835086ee..46487f09802 100644
--- a/sys/dev/raidframe/rf_dagffwr.c
+++ b/sys/dev/raidframe/rf_dagffwr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagffwr.c,v 1.22 2004/03/18 16:40:05 oster Exp $ */
+/* $NetBSD: rf_dagffwr.c,v 1.23 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.22 2004/03/18 16:40:05 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.23 2004/03/20 04:22:05 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.22 2004/03/18 16:40:05 oster Exp $"
#include "rf_dagffrd.h"
#include "rf_general.h"
#include "rf_dagffwr.h"
+#include "rf_map.h"
/******************************************************************************
*
@@ -174,6 +175,7 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
RF_ReconUnitNum_t which_ru;
RF_RaidLayout_t *layoutPtr;
RF_PhysDiskAddr_t *pda;
+ RF_VoidPointerListElem_t *vple;
layoutPtr = &(raidPtr->Layout);
parityStripeID = rf_RaidAddressToParityStripeID(layoutPtr,
@@ -350,9 +352,12 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
}
}
if ((!allowBufferRecycle) || (i == nRodNodes)) {
- RF_MallocAndAdd(xorNode->results[0],
- rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit),
- (void *), allocList);
+ xorNode->results[0] = rf_AllocIOBuffer(raidPtr,
+ rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit));
+ vple = rf_AllocVPListElem();
+ vple->p = xorNode->results[0];
+ vple->next = dag_h->iobufs;
+ dag_h->iobufs = vple;
} else {
/* this works because the only way we get here is if
allowBufferRecycle is true and we went through the
diff --git a/sys/dev/raidframe/rf_dagutils.c b/sys/dev/raidframe/rf_dagutils.c
index 5a0c4a5cd70..b33eafcc25a 100644
--- a/sys/dev/raidframe/rf_dagutils.c
+++ b/sys/dev/raidframe/rf_dagutils.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagutils.c,v 1.40 2004/03/19 17:01:26 oster Exp $ */
+/* $NetBSD: rf_dagutils.c,v 1.41 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.40 2004/03/19 17:01:26 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.41 2004/03/20 04:22:05 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -66,7 +66,6 @@ static void rf_ValidateBranchVisitedBits(RF_DagNode_t *, int, int);
static void rf_ValidateVisitedBits(RF_DagHeader_t *);
#endif /* RF_DEBUG_VALIDATE_DAG */
-
/* The maximum number of nodes in a DAG is bounded by
(2 * raidPtr->Layout->numDataCol) + (1 * layoutPtr->numParityCol) +
@@ -181,6 +180,7 @@ rf_FreeDAG(RF_DagHeader_t *dag_h)
RF_AccessStripeMapHeader_t *asmap, *t_asmap;
RF_PhysDiskAddr_t *pda;
RF_DagNode_t *tmpnode;
+ RF_VoidPointerListElem_t *tmpiobuf;
RF_DagHeader_t *nextDag;
while (dag_h) {
@@ -196,6 +196,13 @@ rf_FreeDAG(RF_DagHeader_t *dag_h)
dag_h->pda_cleanup_list = dag_h->pda_cleanup_list->next;
rf_FreePhysDiskAddr(pda);
}
+ while (dag_h->iobufs) {
+ tmpiobuf = dag_h->iobufs;
+ dag_h->iobufs = dag_h->iobufs->next;
+ if (tmpiobuf->p)
+ rf_FreeIOBuffer(dag_h->raidPtr, tmpiobuf->p);
+ rf_FreeVPListElem(tmpiobuf);
+ }
while (dag_h->nodes) {
tmpnode = dag_h->nodes;
dag_h->nodes = dag_h->nodes->list_next;
@@ -221,6 +228,9 @@ rf_FreeDAG(RF_DagHeader_t *dag_h)
#define RF_MAX_FREE_FUNCLIST 128
#define RF_MIN_FREE_FUNCLIST 32
+#define RF_MAX_FREE_BUFFERS 128
+#define RF_MIN_FREE_BUFFERS 32
+
static void rf_ShutdownDAGs(void *);
static void
rf_ShutdownDAGs(void *ignored)
@@ -347,11 +357,63 @@ rf_AllocBuffer(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda,
RF_AllocListElem_t *allocList)
{
char *p;
+ p = rf_AllocIOBuffer(raidPtr, pda->numSector << raidPtr->logBytesPerSector);
- RF_MallocAndAdd(p, pda->numSector << raidPtr->logBytesPerSector,
- (char *), allocList);
+ if (allocList)
+ rf_AddToAllocList(allocList, p, pda->numSector << raidPtr->logBytesPerSector);
return ((void *) p);
}
+
+void *
+rf_AllocIOBuffer(RF_Raid_t *raidPtr, int size)
+{
+ void *p;
+
+ RF_ASSERT(size <= (raidPtr->Layout.sectorsPerStripeUnit <<
+ raidPtr->logBytesPerSector));
+
+ p = malloc( raidPtr->Layout.sectorsPerStripeUnit <<
+ raidPtr->logBytesPerSector,
+ M_RAIDFRAME, M_NOWAIT);
+ if (!p) {
+ RF_LOCK_MUTEX(raidPtr->mutex);
+ if (raidPtr->iobuf_count > 0) {
+ p = raidPtr->iobuf;
+ raidPtr->iobuf = raidPtr->iobuf->next;
+ raidPtr->iobuf_count--;
+ } else {
+#ifdef DIAGNOSTIC
+ printf("raid%d: Help! Out of emergency buffers!\n", raidPtr->raidid);
+#endif
+ }
+ RF_UNLOCK_MUTEX(raidPtr->mutex);
+ if (!p) {
+ /* We didn't get a buffer... not much we can do other than wait,
+ and hope that someone frees up memory for us.. */
+ p = malloc( raidPtr->Layout.sectorsPerStripeUnit <<
+ raidPtr->logBytesPerSector,
+ M_RAIDFRAME, M_WAITOK);
+ }
+ }
+ return (p);
+}
+
+void
+rf_FreeIOBuffer(RF_Raid_t *raidPtr, void *p)
+{
+ RF_LOCK_MUTEX(raidPtr->mutex);
+ if (raidPtr->iobuf_count < raidPtr->numEmergencyBuffers) {
+ ((RF_IOBufHeader_t *)p)->next = raidPtr->iobuf;
+ raidPtr->iobuf = p;
+ raidPtr->iobuf_count++;
+ } else {
+ free(p, M_RAIDFRAME);
+ }
+ RF_UNLOCK_MUTEX(raidPtr->mutex);
+}
+
+
+
#if RF_DEBUG_VALIDATE_DAG
/******************************************************************************
*
@@ -877,6 +939,7 @@ rf_MapUnaccessedPortionOfStripe(RF_Raid_t *raidPtr,
{
RF_RaidAddr_t sosRaidAddress, eosRaidAddress;
RF_SectorNum_t sosNumSector, eosNumSector;
+ RF_VoidPointerListElem_t *vple;
RF_ASSERT(asmap->numStripeUnitsAccessed > (layoutPtr->numDataCol / 2));
/* generate an access map for the region of the array from start of
@@ -886,7 +949,11 @@ rf_MapUnaccessedPortionOfStripe(RF_Raid_t *raidPtr,
if (!rf_RaidAddressStripeAligned(layoutPtr, asmap->raidAddress)) {
sosRaidAddress = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, asmap->raidAddress);
sosNumSector = asmap->raidAddress - sosRaidAddress;
- RF_MallocAndAdd(*sosBuffer, rf_RaidAddressToByte(raidPtr, sosNumSector), (char *), allocList);
+ *sosBuffer = rf_AllocIOBuffer(raidPtr, rf_RaidAddressToByte(raidPtr, sosNumSector));
+ vple = rf_AllocVPListElem();
+ vple->p = *sosBuffer;
+ vple->next = dag_h->iobufs;
+ dag_h->iobufs = vple;
new_asm_h[0] = rf_MapAccess(raidPtr, sosRaidAddress, sosNumSector, *sosBuffer, RF_DONT_REMAP);
new_asm_h[0]->next = dag_h->asmList;
dag_h->asmList = new_asm_h[0];
@@ -902,7 +969,11 @@ rf_MapUnaccessedPortionOfStripe(RF_Raid_t *raidPtr,
if (!rf_RaidAddressStripeAligned(layoutPtr, asmap->endRaidAddress)) {
eosRaidAddress = asmap->endRaidAddress;
eosNumSector = rf_RaidAddressOfNextStripeBoundary(layoutPtr, eosRaidAddress) - eosRaidAddress;
- RF_MallocAndAdd(*eosBuffer, rf_RaidAddressToByte(raidPtr, eosNumSector), (char *), allocList);
+ *eosBuffer = rf_AllocIOBuffer(raidPtr, rf_RaidAddressToByte(raidPtr, eosNumSector));
+ vple = rf_AllocVPListElem();
+ vple->p = *eosBuffer;
+ vple->next = dag_h->iobufs;
+ dag_h->iobufs = vple;
new_asm_h[1] = rf_MapAccess(raidPtr, eosRaidAddress, eosNumSector, *eosBuffer, RF_DONT_REMAP);
new_asm_h[1]->next = dag_h->asmList;
dag_h->asmList = new_asm_h[1];
diff --git a/sys/dev/raidframe/rf_dagutils.h b/sys/dev/raidframe/rf_dagutils.h
index b396a89d039..01af7b6b256 100644
--- a/sys/dev/raidframe/rf_dagutils.h
+++ b/sys/dev/raidframe/rf_dagutils.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagutils.h,v 1.12 2004/03/19 17:01:26 oster Exp $ */
+/* $NetBSD: rf_dagutils.h,v 1.13 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -85,9 +85,13 @@ void rf_FreeDAGPCache(void *);
RF_FuncList_t *rf_AllocFuncList(void);
void rf_FreeFuncList(RF_FuncList_t *);
+
+
void *rf_AllocBuffer(RF_Raid_t * raidPtr,
RF_PhysDiskAddr_t * pda,
RF_AllocListElem_t * allocList);
+void *rf_AllocIOBuffer(RF_Raid_t *, int);
+void rf_FreeIOBuffer(RF_Raid_t *, void *);
char *rf_NodeStatusString(RF_DagNode_t * node);
diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c
index 605e9ed55df..7de64e881ae 100644
--- a/sys/dev/raidframe/rf_driver.c
+++ b/sys/dev/raidframe/rf_driver.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_driver.c,v 1.96 2004/03/13 02:31:12 oster Exp $ */
+/* $NetBSD: rf_driver.c,v 1.97 2004/03/20 04:22:05 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -73,7 +73,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.96 2004/03/13 02:31:12 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.97 2004/03/20 04:22:05 oster Exp $");
#include "opt_raid_diagnostic.h"
@@ -280,7 +280,8 @@ int
rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac)
{
RF_RowCol_t col;
- int rc;
+ RF_IOBufHeader_t *tmpbuf;
+ int rc, i;
RF_LOCK_LKMGR_MUTEX(configureMutex);
configureCount++;
@@ -393,6 +394,31 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac)
raidPtr->keep_acc_totals = 1;
}
+ /* Allocate a bunch of buffers to be used in low-memory conditions */
+ raidPtr->iobuf = NULL;
+ /* XXX next line needs tuning... */
+ raidPtr->numEmergencyBuffers = 10 * raidPtr->numCol;
+#if DEBUG
+ printf("raid%d: allocating %d buffers of %d bytes.\n",
+ raidPtr->raidid,
+ raidPtr->numEmergencyBuffers,
+ (int)(raidPtr->Layout.sectorsPerStripeUnit <<
+ raidPtr->logBytesPerSector));
+#endif
+ for (i = 0; i < raidPtr->numEmergencyBuffers; i++) {
+ tmpbuf = malloc( raidPtr->Layout.sectorsPerStripeUnit <<
+ raidPtr->logBytesPerSector,
+ M_RAIDFRAME, M_NOWAIT);
+ if (tmpbuf) {
+ tmpbuf->next = raidPtr->iobuf;
+ raidPtr->iobuf = tmpbuf;
+ raidPtr->iobuf_count++;
+ } else {
+ printf("raid%d: failed to allocate emergency buffer!\n",
+ raidPtr->raidid);
+ }
+ }
+
raidPtr->valid = 1;
printf("raid%d: %s\n", raidPtr->raidid,
diff --git a/sys/dev/raidframe/rf_layout.h b/sys/dev/raidframe/rf_layout.h
index 8cb3636c59e..21939abeca9 100644
--- a/sys/dev/raidframe/rf_layout.h
+++ b/sys/dev/raidframe/rf_layout.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_layout.h,v 1.13 2004/03/19 02:34:30 oster Exp $ */
+/* $NetBSD: rf_layout.h,v 1.14 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -170,6 +170,14 @@ struct RF_VoidFunctionPointerListElem_s {
RF_VoidFunctionPointerListElem_t *next;
};
+/* We need something to just be a linked list of anonymous pointers
+ to stuff */
+typedef struct RF_VoidPointerListElem_s RF_VoidPointerListElem_t;
+struct RF_VoidPointerListElem_s {
+ void *p;
+ RF_VoidPointerListElem_t *next;
+};
+
/* A structure to be used in a linked list to keep track of ASM Headers */
typedef struct RF_ASMHeaderListElem_s RF_ASMHeaderListElem_t;
struct RF_ASMHeaderListElem_s {
diff --git a/sys/dev/raidframe/rf_map.c b/sys/dev/raidframe/rf_map.c
index c40f557e632..8b5d9b8aa0d 100644
--- a/sys/dev/raidframe/rf_map.c
+++ b/sys/dev/raidframe/rf_map.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_map.c,v 1.36 2004/03/19 15:16:18 oster Exp $ */
+/* $NetBSD: rf_map.c,v 1.37 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
**************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.36 2004/03/19 15:16:18 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.37 2004/03/20 04:22:05 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -331,6 +331,9 @@ rf_MarkFailuresInASMList(RF_Raid_t *raidPtr,
#define RF_MAX_FREE_VFPLE 128
#define RF_MIN_FREE_VFPLE 32
+#define RF_MAX_FREE_VPLE 128
+#define RF_MIN_FREE_VPLE 32
+
/* called at shutdown time. So far, all that is necessary is to
release all the free lists */
@@ -340,7 +343,11 @@ rf_ShutdownMapModule(void *ignored)
{
pool_destroy(&rf_pools.asm_hdr);
pool_destroy(&rf_pools.asmap);
+ pool_destroy(&rf_pools.asmhle);
pool_destroy(&rf_pools.pda);
+ pool_destroy(&rf_pools.fss);
+ pool_destroy(&rf_pools.vfple);
+ pool_destroy(&rf_pools.vple);
}
int
@@ -359,6 +366,8 @@ rf_ConfigureMapModule(RF_ShutdownList_t **listp)
"rf_fss_pl", RF_MIN_FREE_FSS, RF_MAX_FREE_FSS);
rf_pool_init(&rf_pools.vfple, sizeof(RF_VoidFunctionPointerListElem_t),
"rf_vfple_pl", RF_MIN_FREE_VFPLE, RF_MAX_FREE_VFPLE);
+ rf_pool_init(&rf_pools.vple, sizeof(RF_VoidPointerListElem_t),
+ "rf_vple_pl", RF_MIN_FREE_VPLE, RF_MAX_FREE_VPLE);
rf_ShutdownCreate(listp, rf_ShutdownMapModule, NULL);
return (0);
@@ -400,6 +409,25 @@ rf_FreeVFPListElem(RF_VoidFunctionPointerListElem_t *p)
pool_put(&rf_pools.vfple, p);
}
+
+RF_VoidPointerListElem_t *
+rf_AllocVPListElem()
+{
+ RF_VoidPointerListElem_t *p;
+
+ p = pool_get(&rf_pools.vple, PR_WAITOK);
+ memset((char *) p, 0, sizeof(RF_VoidPointerListElem_t));
+
+ return (p);
+}
+
+void
+rf_FreeVPListElem(RF_VoidPointerListElem_t *p)
+{
+
+ pool_put(&rf_pools.vple, p);
+}
+
RF_ASMHeaderListElem_t *
rf_AllocASMHeaderListElem()
{
diff --git a/sys/dev/raidframe/rf_map.h b/sys/dev/raidframe/rf_map.h
index c25a1d3f631..cc177ba3dd1 100644
--- a/sys/dev/raidframe/rf_map.h
+++ b/sys/dev/raidframe/rf_map.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_map.h,v 1.10 2004/03/19 02:27:44 oster Exp $ */
+/* $NetBSD: rf_map.h,v 1.11 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -60,6 +60,8 @@ void rf_ASMCheckStatus(RF_Raid_t *, RF_PhysDiskAddr_t *, RF_AccessStripeMap_t *,
RF_VoidFunctionPointerListElem_t *rf_AllocVFPListElem(void);
void rf_FreeVFPListElem(RF_VoidFunctionPointerListElem_t *);
+RF_VoidPointerListElem_t *rf_AllocVPListElem(void);
+void rf_FreeVPListElem(RF_VoidPointerListElem_t *);
RF_ASMHeaderListElem_t *rf_AllocASMHeaderListElem(void);
void rf_FreeASMHeaderListElem(RF_ASMHeaderListElem_t *);
RF_FailedStripe_t *rf_AllocFailedStripeStruct(void);
diff --git a/sys/dev/raidframe/rf_netbsd.h b/sys/dev/raidframe/rf_netbsd.h
index d69695c82d0..41526440a07 100644
--- a/sys/dev/raidframe/rf_netbsd.h
+++ b/sys/dev/raidframe/rf_netbsd.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsd.h,v 1.18 2004/03/19 17:01:26 oster Exp $ */
+/* $NetBSD: rf_netbsd.h,v 1.19 2004/03/20 04:22:05 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -86,11 +86,16 @@ struct RF_Pools_s {
struct pool revent; /* reconstruct events */
struct pool stripelock; /* StripeLock */
struct pool vfple; /* VoidFunctionPtr List Elements */
+ struct pool vple; /* VoidPointer List Elements */
};
extern struct RF_Pools_s rf_pools;
void rf_pool_init(struct pool *, size_t, char *, size_t, size_t);
+typedef struct RF_IOBufHeader_s {
+ struct RF_IOBufHeader_s *next;
+} RF_IOBufHeader_t;
+
/* XXX probably belongs in a different .h file. */
typedef struct RF_AutoConfig_s {
diff --git a/sys/dev/raidframe/rf_raid.h b/sys/dev/raidframe/rf_raid.h
index 62abcfddf15..8fa04f4ff67 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.31 2004/03/19 17:04:35 oster Exp $ */
+/* $NetBSD: rf_raid.h,v 1.32 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -164,6 +164,10 @@ struct RF_Raid_s {
/* and a lock to protect it */
struct simplelock iodone_lock;
+
+ RF_IOBufHeader_t *iobuf; /* I/O buffer free list */
+ int iobuf_count; /* count of I/O buffers on the freelist */
+ int numEmergencyBuffers; /* number of these buffers to pre-allocate */
/*
* Cleanup stuff
*/