summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe/rf_map.c
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/rf_map.c
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/rf_map.c')
-rw-r--r--sys/dev/raidframe/rf_map.c32
1 files changed, 30 insertions, 2 deletions
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()
{