Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe init_rad() and clean_rad() really do..... ...



details:   https://anonhg.NetBSD.org/src/rev/fd96ea750668
branches:  trunk
changeset: 556853:fd96ea750668
user:      oster <oster%NetBSD.org@localhost>
date:      Mon Dec 29 04:00:17 2003 +0000

description:
init_rad() and clean_rad() really do..... very little.. and only serve
to make things look far more complicated than they really are.  It was
also impossible for any of the mutex/cond initializations in
init_rad() to actually fail, making the "error detection code"
unneeded.  Collapse the little work done by init_rad into
rf_AllocRaidAccDesc(), and nuke init_rad() and clean_rad().  Save
another 0.25K in GENERIC.

[To be accurate/complete, init_rad() and clean_rad() *ARE* used in the
simulator version of RAIDframe.  But we're so far removed from that
now that there is no point pretending otherwise.]

diffstat:

 sys/dev/raidframe/rf_driver.c |  39 ++++-----------------------------------
 1 files changed, 4 insertions(+), 35 deletions(-)

diffs (88 lines):

diff -r c548a1fb746a -r fd96ea750668 sys/dev/raidframe/rf_driver.c
--- a/sys/dev/raidframe/rf_driver.c     Mon Dec 29 03:43:07 2003 +0000
+++ b/sys/dev/raidframe/rf_driver.c     Mon Dec 29 04:00:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_driver.c,v 1.73 2003/12/29 03:33:48 oster Exp $     */
+/*     $NetBSD: rf_driver.c,v 1.74 2003/12/29 04:00:17 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.73 2003/12/29 03:33:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.74 2003/12/29 04:00:17 oster Exp $");
 
 #include "opt_raid_diagnostic.h"
 
@@ -137,8 +137,6 @@
 static void rf_ConfigureDebug(RF_Config_t * cfgPtr);
 static void set_debug_option(char *name, long val);
 static void rf_UnconfigureArray(void);
-static int init_rad(RF_RaidAccessDesc_t *);
-static void clean_rad(RF_RaidAccessDesc_t *);
 static void rf_ShutdownRDFreeList(void *);
 static int rf_ConfigureRDFreeList(RF_ShutdownList_t **);
 
@@ -465,34 +463,6 @@
        return (0);
 }
 
-static int 
-init_rad(desc)
-       RF_RaidAccessDesc_t *desc;
-{
-       int     rc;
-
-       rc = rf_mutex_init(&desc->mutex);
-       if (rc) {
-               rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
-               return (rc);
-       }
-       rc = rf_cond_init(&desc->cond);
-       if (rc) {
-               rf_print_unable_to_init_cond(__FILE__, __LINE__, rc);
-               rf_mutex_destroy(&desc->mutex);
-               return (rc);
-       }
-       return (0);
-}
-
-static void 
-clean_rad(desc)
-       RF_RaidAccessDesc_t *desc;
-{
-       rf_mutex_destroy(&desc->mutex);
-       rf_cond_destroy(&desc->cond);
-}
-
 static void 
 rf_ShutdownRDFreeList(ignored)
        void   *ignored;
@@ -533,7 +503,8 @@
        RF_RaidAccessDesc_t *desc;
 
        desc = pool_get(&rf_rad_pool, PR_WAITOK);
-       init_rad(desc);
+       simple_lock_init(&desc->mutex);
+       desc->cond = 0;
 
        if (raidPtr->waitShutdown) {
                /*
@@ -542,7 +513,6 @@
                 */
 
                RF_UNLOCK_MUTEX(rf_rad_pool_lock);
-               clean_rad(desc);
                pool_put(&rf_rad_pool, desc);
                return (NULL);
        }
@@ -581,7 +551,6 @@
        RF_ASSERT(desc);
 
        rf_FreeAllocList(desc->cleanupList);
-       clean_rad(desc);
        pool_put(&rf_rad_pool, desc);
        raidPtr->nAccOutstanding--;
        if (raidPtr->waitShutdown) {



Home | Main Index | Thread Index | Old Index