diff options
| author | oster <oster@NetBSD.org> | 2004-03-07 21:57:44 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2004-03-07 21:57:44 +0000 |
| commit | 834d494bb273a9c85833dc59452ba403b7c36d0e (patch) | |
| tree | 5110e0481cdf25615448bb7dae97c05ae3eb9130 /sys/dev/raidframe | |
| parent | 7cf74885be4c29b3d825eabbebbf0b4345de82d5 (diff) | |
- Introduce rf_pools which contains all of the various global pools used
by RAIDframe. Convert all other RAIDframe global pools to use pools
defined within this new structure.
- Introduce rf_pool_init(), used for initializing a single pool in
RAIDframe. Teach each of the configuration routines to use
rf_pool_init().
- Cleanup a few pool-related comments.
- Cleanup revent initialization and #defines.
- Add a missing pool_destroy() for the reconbuffer pool.
(Saves another 1K off of an i386 GENERIC kernel, and makes
stuff a lot more readable)
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_alloclist.c | 21 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_callback.c | 20 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_dagutils.c | 49 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_diskqueue.c | 21 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_driver.c | 21 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_map.c | 56 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 30 |
7 files changed, 87 insertions, 131 deletions
diff --git a/sys/dev/raidframe/rf_alloclist.c b/sys/dev/raidframe/rf_alloclist.c index 466e32bf56b..46f2b493799 100644 --- a/sys/dev/raidframe/rf_alloclist.c +++ b/sys/dev/raidframe/rf_alloclist.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_alloclist.c,v 1.19 2004/03/05 02:53:55 oster Exp $ */ +/* $NetBSD: rf_alloclist.c,v 1.20 2004/03/07 21:57:44 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ ***************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.19 2004/03/05 02:53:55 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.20 2004/03/07 21:57:44 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -48,10 +48,10 @@ __KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.19 2004/03/05 02:53:55 oster Exp #include "rf_etimer.h" #include "rf_general.h" #include "rf_shutdown.h" +#include "rf_netbsd.h" #include <sys/pool.h> -static struct pool rf_alloclist_pool; #define RF_AL_FREELIST_MAX 256 #define RF_AL_FREELIST_MIN 64 @@ -59,20 +59,15 @@ static void rf_ShutdownAllocList(void *); static void rf_ShutdownAllocList(void *ignored) { - pool_destroy(&rf_alloclist_pool); + pool_destroy(&rf_pools.alloclist); } int rf_ConfigureAllocList(RF_ShutdownList_t **listp) { - pool_init(&rf_alloclist_pool, sizeof(RF_AllocListElem_t), - 0, 0, 0, "rf_alloclist_pl", NULL); - pool_sethiwat(&rf_alloclist_pool, RF_AL_FREELIST_MAX); - pool_prime(&rf_alloclist_pool, RF_AL_FREELIST_MIN); - pool_setlowat(&rf_alloclist_pool, RF_AL_FREELIST_MIN); - - + rf_pool_init(&rf_pools.alloclist, sizeof(RF_AllocListElem_t), + "rf_alloclist_pl", RF_AL_FREELIST_MIN, RF_AL_FREELIST_MAX); rf_ShutdownCreate(listp, rf_ShutdownAllocList, NULL); return (0); @@ -120,7 +115,7 @@ rf_FreeAllocList(RF_AllocListElem_t *l) while (l) { temp = l; l = l->next; - pool_put(&rf_alloclist_pool, temp); + pool_put(&rf_pools.alloclist, temp); } } @@ -129,7 +124,7 @@ rf_real_MakeAllocList() { RF_AllocListElem_t *p; - p = pool_get(&rf_alloclist_pool, PR_WAITOK); + p = pool_get(&rf_pools.alloclist, PR_WAITOK); memset((char *) p, 0, sizeof(RF_AllocListElem_t)); return (p); } diff --git a/sys/dev/raidframe/rf_callback.c b/sys/dev/raidframe/rf_callback.c index f833b29bbe6..b67315a6669 100644 --- a/sys/dev/raidframe/rf_callback.c +++ b/sys/dev/raidframe/rf_callback.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_callback.c,v 1.14 2004/03/05 02:53:58 oster Exp $ */ +/* $NetBSD: rf_callback.c,v 1.15 2004/03/07 21:57:44 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.14 2004/03/05 02:53:58 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.15 2004/03/07 21:57:44 oster Exp $"); #include <dev/raidframe/raidframevar.h> #include <sys/pool.h> @@ -45,8 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.14 2004/03/05 02:53:58 oster Exp $ #include "rf_debugMem.h" #include "rf_general.h" #include "rf_shutdown.h" +#include "rf_netbsd.h" -static struct pool rf_callback_pool; #define RF_MAX_FREE_CALLBACK 64 #define RF_MIN_FREE_CALLBACK 32 @@ -54,7 +54,7 @@ static void rf_ShutdownCallback(void *); static void rf_ShutdownCallback(void *ignored) { - pool_destroy(&rf_callback_pool); + pool_destroy(&rf_pools.callback); } int @@ -62,12 +62,8 @@ rf_ConfigureCallback(listp) RF_ShutdownList_t **listp; { - pool_init(&rf_callback_pool, sizeof(RF_CallbackDesc_t), 0, 0, 0, - "rf_callbackpl", NULL); - pool_sethiwat(&rf_callback_pool, RF_MAX_FREE_CALLBACK); - pool_prime(&rf_callback_pool, RF_MIN_FREE_CALLBACK); - pool_setlowat(&rf_callback_pool, RF_MIN_FREE_CALLBACK); - + rf_pool_init(&rf_pools.callback, sizeof(RF_CallbackDesc_t), + "rf_callbackpl", RF_MIN_FREE_CALLBACK, RF_MAX_FREE_CALLBACK); rf_ShutdownCreate(listp, rf_ShutdownCallback, NULL); return (0); @@ -78,7 +74,7 @@ rf_AllocCallbackDesc() { RF_CallbackDesc_t *p; - p = pool_get(&rf_callback_pool, PR_WAITOK); + p = pool_get(&rf_pools.callback, PR_WAITOK); return (p); } @@ -86,5 +82,5 @@ void rf_FreeCallbackDesc(p) RF_CallbackDesc_t *p; { - pool_put(&rf_callback_pool, p); + pool_put(&rf_pools.callback, p); } diff --git a/sys/dev/raidframe/rf_dagutils.c b/sys/dev/raidframe/rf_dagutils.c index 15c3669deaf..521880c6b36 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.35 2004/03/07 02:25:36 oster Exp $ */ +/* $NetBSD: rf_dagutils.c,v 1.36 2004/03/07 21:57:44 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.35 2004/03/07 02:25:36 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.36 2004/03/07 21:57:44 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -167,15 +167,12 @@ rf_FreeDAG(RF_DagHeader_t *dag_h) } } -static struct pool rf_dagh_pool; #define RF_MAX_FREE_DAGH 128 #define RF_MIN_FREE_DAGH 32 -static struct pool rf_daglist_pool; #define RF_MAX_FREE_DAGLIST 128 #define RF_MIN_FREE_DAGLIST 32 -static struct pool rf_funclist_pool; #define RF_MAX_FREE_FUNCLIST 128 #define RF_MIN_FREE_FUNCLIST 32 @@ -183,33 +180,21 @@ static void rf_ShutdownDAGs(void *); static void rf_ShutdownDAGs(void *ignored) { - pool_destroy(&rf_dagh_pool); - pool_destroy(&rf_daglist_pool); - pool_destroy(&rf_funclist_pool); + pool_destroy(&rf_pools.dagh); + pool_destroy(&rf_pools.daglist); + pool_destroy(&rf_pools.funclist); } int rf_ConfigureDAGs(RF_ShutdownList_t **listp) { - pool_init(&rf_dagh_pool, sizeof(RF_DagHeader_t), 0, 0, 0, - "rf_dagh_pl", NULL); - pool_sethiwat(&rf_dagh_pool, RF_MAX_FREE_DAGH); - pool_prime(&rf_dagh_pool, RF_MIN_FREE_DAGH); - pool_setlowat(&rf_dagh_pool, RF_MIN_FREE_DAGH); - - pool_init(&rf_daglist_pool, sizeof(RF_DagList_t), 0, 0, 0, - "rf_daglist_pl", NULL); - pool_sethiwat(&rf_daglist_pool, RF_MAX_FREE_DAGLIST); - pool_prime(&rf_daglist_pool, RF_MIN_FREE_DAGLIST); - pool_setlowat(&rf_daglist_pool, RF_MIN_FREE_DAGLIST); - - pool_init(&rf_funclist_pool, sizeof(RF_FuncList_t), 0, 0, 0, - "rf_funcist_pl", NULL); - pool_sethiwat(&rf_funclist_pool, RF_MAX_FREE_FUNCLIST); - pool_prime(&rf_funclist_pool, RF_MIN_FREE_FUNCLIST); - pool_setlowat(&rf_funclist_pool, RF_MIN_FREE_FUNCLIST); - + rf_pool_init(&rf_pools.dagh, sizeof(RF_DagHeader_t), + "rf_dagh_pl", RF_MIN_FREE_DAGH, RF_MAX_FREE_DAGH); + rf_pool_init(&rf_pools.daglist, sizeof(RF_DagList_t), + "rf_daglist_pl", RF_MIN_FREE_DAGLIST, RF_MAX_FREE_DAGLIST); + rf_pool_init(&rf_pools.funclist, sizeof(RF_FuncList_t), + "rf_funclist_pl", RF_MIN_FREE_FUNCLIST, RF_MAX_FREE_FUNCLIST); rf_ShutdownCreate(listp, rf_ShutdownDAGs, NULL); return (0); @@ -220,7 +205,7 @@ rf_AllocDAGHeader() { RF_DagHeader_t *dh; - dh = pool_get(&rf_dagh_pool, PR_WAITOK); + dh = pool_get(&rf_pools.dagh, PR_WAITOK); memset((char *) dh, 0, sizeof(RF_DagHeader_t)); return (dh); } @@ -228,7 +213,7 @@ rf_AllocDAGHeader() void rf_FreeDAGHeader(RF_DagHeader_t * dh) { - pool_put(&rf_dagh_pool, dh); + pool_put(&rf_pools.dagh, dh); } RF_DagList_t * @@ -236,7 +221,7 @@ rf_AllocDAGList() { RF_DagList_t *dagList; - dagList = pool_get(&rf_daglist_pool, PR_WAITOK); + dagList = pool_get(&rf_pools.daglist, PR_WAITOK); memset(dagList, 0, sizeof(RF_DagList_t)); return (dagList); @@ -245,7 +230,7 @@ rf_AllocDAGList() void rf_FreeDAGList(RF_DagList_t *dagList) { - pool_put(&rf_daglist_pool, dagList); + pool_put(&rf_pools.daglist, dagList); } RF_FuncList_t * @@ -253,7 +238,7 @@ rf_AllocFuncList() { RF_FuncList_t *funcList; - funcList = pool_get(&rf_funclist_pool, PR_WAITOK); + funcList = pool_get(&rf_pools.funclist, PR_WAITOK); memset(funcList, 0, sizeof(RF_FuncList_t)); return (funcList); @@ -262,7 +247,7 @@ rf_AllocFuncList() void rf_FreeFuncList(RF_FuncList_t *funcList) { - pool_put(&rf_funclist_pool, funcList); + pool_put(&rf_pools.funclist, funcList); } diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c index 22f3e90a203..a40b825a0fd 100644 --- a/sys/dev/raidframe/rf_diskqueue.c +++ b/sys/dev/raidframe/rf_diskqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.31 2004/03/05 02:53:55 oster Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.32 2004/03/07 21:57:44 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ ****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.31 2004/03/05 02:53:55 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.32 2004/03/07 21:57:44 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -147,7 +147,6 @@ static const RF_DiskQueueSW_t diskqueuesw[] = { }; #define NUM_DISK_QUEUE_TYPES (sizeof(diskqueuesw)/sizeof(RF_DiskQueueSW_t)) -static struct pool rf_dqd_pool; #define RF_MAX_FREE_DQD 256 #define RF_MIN_FREE_DQD 64 @@ -182,19 +181,15 @@ rf_ConfigureDiskQueue(RF_Raid_t *raidPtr, RF_DiskQueue_t *diskqueue, static void rf_ShutdownDiskQueueSystem(void *ignored) { - pool_destroy(&rf_dqd_pool); + pool_destroy(&rf_pools.dqd); } int rf_ConfigureDiskQueueSystem(RF_ShutdownList_t **listp) { - pool_init(&rf_dqd_pool, sizeof(RF_DiskQueueData_t), 0, 0, 0, - "rf_dqd_pl", NULL); - pool_sethiwat(&rf_dqd_pool, RF_MAX_FREE_DQD); - pool_prime(&rf_dqd_pool, RF_MIN_FREE_DQD); - pool_setlowat(&rf_dqd_pool, RF_MIN_FREE_DQD); - + rf_pool_init(&rf_pools.dqd, sizeof(RF_DiskQueueData_t), + "rf_dqd_pl", RF_MIN_FREE_DQD, RF_MAX_FREE_DQD); rf_ShutdownCreate(listp, rf_ShutdownDiskQueueSystem, NULL); return (0); @@ -455,13 +450,13 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect, { RF_DiskQueueData_t *p; - p = pool_get(&rf_dqd_pool, PR_WAITOK); + p = pool_get(&rf_pools.dqd, PR_WAITOK); p->bp = pool_get(&bufpool, PR_NOWAIT); /* XXX: make up our minds here. WAITOK, or NOWAIT?? */ if (p->bp == NULL) { /* no memory for the buffer!?!? */ - pool_put(&rf_dqd_pool, p); + pool_put(&rf_pools.dqd, p); return(NULL); } @@ -487,5 +482,5 @@ void rf_FreeDiskQueueData(RF_DiskQueueData_t *p) { pool_put(&bufpool, p->bp); - pool_put(&rf_dqd_pool, p); + pool_put(&rf_pools.dqd, p); } diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 320773d50f7..32813580077 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.88 2004/03/05 02:53:56 oster Exp $ */ +/* $NetBSD: rf_driver.c,v 1.89 2004/03/07 21:57:45 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.88 2004/03/05 02:53:56 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.89 2004/03/07 21:57:45 oster Exp $"); #include "opt_raid_diagnostic.h" @@ -123,7 +123,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.88 2004/03/05 02:53:56 oster Exp $") /* rad == RF_RaidAccessDesc_t */ RF_DECLARE_MUTEX(rf_rad_pool_lock) -static struct pool rf_rad_pool; #define RF_MAX_FREE_RAD 128 #define RF_MIN_FREE_RAD 32 @@ -425,19 +424,15 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) static void rf_ShutdownRDFreeList(void *ignored) { - pool_destroy(&rf_rad_pool); + pool_destroy(&rf_pools.rad); } static int rf_ConfigureRDFreeList(RF_ShutdownList_t **listp) { - pool_init(&rf_rad_pool, sizeof(RF_RaidAccessDesc_t), 0, 0, 0, - "rf_rad_pl", NULL); - pool_sethiwat(&rf_rad_pool, RF_MAX_FREE_RAD); - pool_prime(&rf_rad_pool, RF_MIN_FREE_RAD); - pool_setlowat(&rf_rad_pool, RF_MIN_FREE_RAD); - + rf_pool_init(&rf_pools.rad, sizeof(RF_RaidAccessDesc_t), + "rf_rad_pl", RF_MIN_FREE_RAD, RF_MAX_FREE_RAD); rf_ShutdownCreate(listp, rf_ShutdownRDFreeList, NULL); simple_lock_init(&rf_rad_pool_lock); return (0); @@ -451,7 +446,7 @@ rf_AllocRaidAccDesc(RF_Raid_t *raidPtr, RF_IoType_t type, { RF_RaidAccessDesc_t *desc; - desc = pool_get(&rf_rad_pool, PR_WAITOK); + desc = pool_get(&rf_pools.rad, PR_WAITOK); simple_lock_init(&desc->mutex); RF_LOCK_MUTEX(rf_rad_pool_lock); @@ -462,7 +457,7 @@ rf_AllocRaidAccDesc(RF_Raid_t *raidPtr, RF_IoType_t type, */ RF_UNLOCK_MUTEX(rf_rad_pool_lock); - pool_put(&rf_rad_pool, desc); + pool_put(&rf_pools.rad, desc); return (NULL); } raidPtr->nAccOutstanding++; @@ -510,7 +505,7 @@ rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *desc) } rf_FreeAllocList(desc->cleanupList); - pool_put(&rf_rad_pool, desc); + pool_put(&rf_pools.rad, desc); RF_LOCK_MUTEX(rf_rad_pool_lock); raidPtr->nAccOutstanding--; if (raidPtr->waitShutdown) { diff --git a/sys/dev/raidframe/rf_map.c b/sys/dev/raidframe/rf_map.c index 800aeef2006..f16e1575188 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.31 2004/03/07 02:59:25 oster Exp $ */ +/* $NetBSD: rf_map.c,v 1.32 2004/03/07 21:57:44 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.31 2004/03/07 02:59:25 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.32 2004/03/07 21:57:44 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -313,18 +313,12 @@ rf_MarkFailuresInASMList(RF_Raid_t *raidPtr, * ***************************************************************************/ -static struct pool rf_asmhdr_pool; #define RF_MAX_FREE_ASMHDR 128 #define RF_MIN_FREE_ASMHDR 32 -static struct pool rf_asm_pool; #define RF_MAX_FREE_ASM 192 #define RF_MIN_FREE_ASM 64 -static struct pool rf_pda_pool; /* may need to be visible for - rf_dagdegrd.c and rf_dagdegwr.c, - if they can be convinced to free - the space easily */ #define RF_MAX_FREE_PDA 192 #define RF_MIN_FREE_PDA 64 @@ -334,33 +328,21 @@ static void rf_ShutdownMapModule(void *); static void rf_ShutdownMapModule(void *ignored) { - pool_destroy(&rf_asmhdr_pool); - pool_destroy(&rf_asm_pool); - pool_destroy(&rf_pda_pool); + pool_destroy(&rf_pools.asm_hdr); + pool_destroy(&rf_pools.asmap); + pool_destroy(&rf_pools.pda); } int rf_ConfigureMapModule(RF_ShutdownList_t **listp) { - pool_init(&rf_asmhdr_pool, sizeof(RF_AccessStripeMapHeader_t), - 0, 0, 0, "rf_asmhdr_pl", NULL); - pool_sethiwat(&rf_asmhdr_pool, RF_MAX_FREE_ASMHDR); - pool_prime(&rf_asmhdr_pool, RF_MIN_FREE_ASMHDR); - pool_setlowat(&rf_asmhdr_pool, RF_MIN_FREE_ASMHDR); - - pool_init(&rf_asm_pool, sizeof(RF_AccessStripeMap_t), - 0, 0, 0, "rf_asm_pl", NULL); - pool_sethiwat(&rf_asm_pool, RF_MAX_FREE_ASM); - pool_prime(&rf_asm_pool, RF_MIN_FREE_ASM); - pool_setlowat(&rf_asm_pool, RF_MIN_FREE_ASM); - - pool_init(&rf_pda_pool, sizeof(RF_PhysDiskAddr_t), - 0, 0, 0, "rf_pda_pl", NULL); - pool_sethiwat(&rf_pda_pool, RF_MAX_FREE_PDA); - pool_prime(&rf_pda_pool, RF_MIN_FREE_PDA); - pool_setlowat(&rf_pda_pool, RF_MIN_FREE_PDA); - + rf_pool_init(&rf_pools.asm_hdr, sizeof(RF_AccessStripeMapHeader_t), + "rf_asmhdr_pl", RF_MIN_FREE_ASMHDR, RF_MAX_FREE_ASMHDR); + rf_pool_init(&rf_pools.asmap, sizeof(RF_AccessStripeMap_t), + "rf_asm_pl", RF_MIN_FREE_ASM, RF_MAX_FREE_ASM); + rf_pool_init(&rf_pools.pda, sizeof(RF_PhysDiskAddr_t), + "rf_pda_pl", RF_MIN_FREE_PDA, RF_MAX_FREE_PDA); rf_ShutdownCreate(listp, rf_ShutdownMapModule, NULL); return (0); @@ -371,7 +353,7 @@ rf_AllocAccessStripeMapHeader() { RF_AccessStripeMapHeader_t *p; - p = pool_get(&rf_asmhdr_pool, PR_WAITOK); + p = pool_get(&rf_pools.asm_hdr, PR_WAITOK); memset((char *) p, 0, sizeof(RF_AccessStripeMapHeader_t)); return (p); @@ -380,7 +362,7 @@ rf_AllocAccessStripeMapHeader() void rf_FreeAccessStripeMapHeader(RF_AccessStripeMapHeader_t *p) { - pool_put(&rf_asmhdr_pool, p); + pool_put(&rf_pools.asm_hdr, p); } RF_PhysDiskAddr_t * @@ -388,7 +370,7 @@ rf_AllocPhysDiskAddr() { RF_PhysDiskAddr_t *p; - p = pool_get(&rf_pda_pool, PR_WAITOK); + p = pool_get(&rf_pools.pda, PR_WAITOK); memset((char *) p, 0, sizeof(RF_PhysDiskAddr_t)); return (p); @@ -407,7 +389,7 @@ rf_AllocPDAList(int count) p = NULL; prev = NULL; for (i = 0; i < count; i++) { - p = pool_get(&rf_pda_pool, PR_WAITOK); + p = pool_get(&rf_pools.pda, PR_WAITOK); p->next = prev; prev = p; } @@ -419,7 +401,7 @@ rf_AllocPDAList(int count) void rf_FreePhysDiskAddr(RF_PhysDiskAddr_t *p) { - pool_put(&rf_pda_pool, p); + pool_put(&rf_pools.pda, p); } #endif @@ -431,7 +413,7 @@ rf_FreePDAList(RF_PhysDiskAddr_t *pda_list) p=pda_list; while (p) { tmp = p->next; - pool_put(&rf_pda_pool, p); + pool_put(&rf_pools.pda, p); p = tmp; } } @@ -450,7 +432,7 @@ rf_AllocASMList(int count) p = NULL; prev = NULL; for (i = 0; i < count; i++) { - p = pool_get(&rf_asm_pool, PR_WAITOK); + p = pool_get(&rf_pools.asmap, PR_WAITOK); p->next = prev; prev = p; } @@ -465,7 +447,7 @@ rf_FreeASMList(RF_AccessStripeMap_t *asm_list) p=asm_list; while (p) { tmp = p->next; - pool_put(&rf_asm_pool, p); + pool_put(&rf_pools.asmap, p); p = tmp; } } diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index ff3a8da57d5..502a4a9bf60 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.176 2004/03/05 02:53:58 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.177 2004/03/07 21:57:44 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -146,7 +146,7 @@ ***********************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.176 2004/03/05 02:53:58 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.177 2004/03/07 21:57:44 oster Exp $"); #include <sys/param.h> #include <sys/errno.h> @@ -244,9 +244,6 @@ struct raidbuf { RF_DiskQueueData_t *req;/* the request that this was part of.. */ }; -/* component buffer pool */ -struct pool raidframe_cbufpool; - /* XXX Not sure if the following should be replacing the raidPtrs above, or if it should be used in conjunction with that... */ @@ -333,6 +330,8 @@ static int raidautoconfig = 0; /* Debugging, mostly. Set to 0 to not RAID_AUTOCONFIG as an option in the kernel config file. */ +struct RF_Pools_s rf_pools; + void raidattach(int num) { @@ -361,10 +360,9 @@ raidattach(int num) } /* Initialize the component buffer pool. */ - pool_init(&raidframe_cbufpool, sizeof(struct raidbuf), 0, - 0, 0, "raidpl", NULL); - pool_prime(&raidframe_cbufpool, num * RAIDOUTSTANDING); - pool_setlowat(&raidframe_cbufpool, num * RAIDOUTSTANDING); + rf_pool_init(&rf_pools.cbuf, sizeof(struct raidbuf), + "raidpl", num * RAIDOUTSTANDING, + 2 * num * RAIDOUTSTANDING); rf_mutex_init(&rf_sparet_wait_mutex); @@ -1818,7 +1816,7 @@ rf_DispatchKernelIO(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req) bp->b_error = 0; } #endif - raidbp = pool_get(&raidframe_cbufpool, PR_NOWAIT); + raidbp = pool_get(&rf_pools.cbuf, PR_NOWAIT); if (raidbp == NULL) { bp->b_flags |= B_ERROR; bp->b_error = ENOMEM; @@ -1957,7 +1955,7 @@ KernelWakeupFunc(struct buf *vbp) } - pool_put(&raidframe_cbufpool, raidbp); + pool_put(&rf_pools.cbuf, raidbp); /* Fill in the error value */ @@ -3300,3 +3298,13 @@ rf_disk_unbusy(RF_RaidAccessDesc_t *desc) disk_unbusy(&raid_softc[desc->raidPtr->raidid].sc_dkdev, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); } + +void +rf_pool_init(struct pool *p, size_t size, char *w_chan, + size_t min, size_t max) +{ + pool_init(p, size, 0, 0, 0, w_chan, NULL); + pool_sethiwat(p, max); + pool_prime(p, min); + pool_setlowat(p, min); +} |
