Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe - Introduce rf_pools which contains all of...



details:   https://anonhg.NetBSD.org/src/rev/eb4f062261e3
branches:  trunk
changeset: 559069:eb4f062261e3
user:      oster <oster%NetBSD.org@localhost>
date:      Sun Mar 07 21:57:44 2004 +0000

description:
- 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:

 sys/dev/raidframe/rf_alloclist.c   |  21 +++++--------
 sys/dev/raidframe/rf_callback.c    |  20 +++++--------
 sys/dev/raidframe/rf_dagutils.c    |  49 +++++++++++---------------------
 sys/dev/raidframe/rf_diskqueue.c   |  21 +++++--------
 sys/dev/raidframe/rf_driver.c      |  21 +++++--------
 sys/dev/raidframe/rf_map.c         |  56 ++++++++++++-------------------------
 sys/dev/raidframe/rf_netbsdkintf.c |  30 ++++++++++++-------
 7 files changed, 87 insertions(+), 131 deletions(-)

diffs (truncated from 654 to 300 lines):

diff -r dd026ea0ba76 -r eb4f062261e3 sys/dev/raidframe/rf_alloclist.c
--- a/sys/dev/raidframe/rf_alloclist.c  Sun Mar 07 21:52:40 2004 +0000
+++ b/sys/dev/raidframe/rf_alloclist.c  Sun Mar 07 21:57:44 2004 +0000
@@ -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 @@
 #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 *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 @@
        while (l) {
                temp = l;
                l = l->next;
-               pool_put(&rf_alloclist_pool, temp);
+               pool_put(&rf_pools.alloclist, temp);
        }
 }
 
@@ -129,7 +124,7 @@
 {
        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 -r dd026ea0ba76 -r eb4f062261e3 sys/dev/raidframe/rf_callback.c
--- a/sys/dev/raidframe/rf_callback.c   Sun Mar 07 21:52:40 2004 +0000
+++ b/sys/dev/raidframe/rf_callback.c   Sun Mar 07 21:57:44 2004 +0000
@@ -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 @@
 #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 *ignored)
 {
-       pool_destroy(&rf_callback_pool);
+       pool_destroy(&rf_pools.callback);
 }
 
 int 
@@ -62,12 +62,8 @@
        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_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 @@
 rf_FreeCallbackDesc(p)
        RF_CallbackDesc_t *p;
 {
-       pool_put(&rf_callback_pool, p);
+       pool_put(&rf_pools.callback, p);
 }
diff -r dd026ea0ba76 -r eb4f062261e3 sys/dev/raidframe/rf_dagutils.c
--- a/sys/dev/raidframe/rf_dagutils.c   Sun Mar 07 21:52:40 2004 +0000
+++ b/sys/dev/raidframe/rf_dagutils.c   Sun Mar 07 21:57:44 2004 +0000
@@ -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 @@
        }
 }
 
-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 *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_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 @@
 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_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 @@
 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_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 @@
 void
 rf_FreeFuncList(RF_FuncList_t *funcList)
 {
-       pool_put(&rf_funclist_pool, funcList);
+       pool_put(&rf_pools.funclist, funcList);
 }
 
 
diff -r dd026ea0ba76 -r eb4f062261e3 sys/dev/raidframe/rf_diskqueue.c
--- a/sys/dev/raidframe/rf_diskqueue.c  Sun Mar 07 21:52:40 2004 +0000
+++ b/sys/dev/raidframe/rf_diskqueue.c  Sun Mar 07 21:57:44 2004 +0000
@@ -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 @@
 };
 #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 @@
 static void 
 rf_ShutdownDiskQueueSystem(void *ignored)



Home | Main Index | Thread Index | Old Index