_rf_create_managed_mutex() is doing just a simple:
rf_mutex_init(m) now. The rest of the fluff is no longer needed. It also cannot fail, so error checking on rf_create_managed_mutex() is just wasting space. Nuke the #define's associated with rf_create_managed_mutex(). Convert rf_create_managed_mutex(listp,m) to just rf_mutex_init(m). Remove wasteful "error checking" and simplify all instances where this is called. (another 0.3K saved in the binary, but the real savings is in code readability!)
This commit is contained in:
parent
f7db986b43
commit
c629932636
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_debugMem.c,v 1.12 2002/11/23 02:44:15 oster Exp $ */
|
||||
/* $NetBSD: rf_debugMem.c,v 1.13 2003/12/29 05:22:16 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.12 2002/11/23 02:44:15 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.13 2003/12/29 05:22:16 oster Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -126,11 +126,7 @@ rf_ConfigureDebugMem(listp)
|
|||
#if RF_DEBUG_MEM
|
||||
int i, rc;
|
||||
|
||||
rc = rf_create_managed_mutex(listp, &rf_debug_mem_mutex);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_mutex( __FILE__, __LINE__, rc);
|
||||
return (rc);
|
||||
}
|
||||
rf_mutex_init(&rf_debug_mem_mutex);
|
||||
if (rf_memDebug) {
|
||||
for (i = 0; i < RF_MH_TABLESIZE; i++)
|
||||
mh_table[i] = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_diskqueue.c,v 1.24 2003/12/29 03:33:47 oster Exp $ */
|
||||
/* $NetBSD: rf_diskqueue.c,v 1.25 2003/12/29 05:22:16 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.24 2003/12/29 03:33:47 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.25 2003/12/29 05:22:16 oster Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -206,11 +206,7 @@ rf_ConfigureDiskQueue(
|
|||
diskqueue->flags = 0;
|
||||
diskqueue->raidPtr = raidPtr;
|
||||
diskqueue->rf_cinfo = &raidPtr->raid_cinfo[c];
|
||||
rc = rf_create_managed_mutex(listp, &diskqueue->mutex);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
|
||||
return (rc);
|
||||
}
|
||||
rf_mutex_init(&diskqueue->mutex);
|
||||
rc = rf_create_managed_cond(listp, &diskqueue->cond);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_cond(__FILE__, __LINE__, rc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_driver.c,v 1.74 2003/12/29 04:00:17 oster Exp $ */
|
||||
/* $NetBSD: rf_driver.c,v 1.75 2003/12/29 05:22:16 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.74 2003/12/29 04:00:17 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.75 2003/12/29 05:22:16 oster Exp $");
|
||||
|
||||
#include "opt_raid_diagnostic.h"
|
||||
|
||||
|
@ -295,12 +295,7 @@ rf_Shutdown(raidPtr)
|
|||
}
|
||||
|
||||
#define DO_RAID_MUTEX(_m_) { \
|
||||
rc = rf_create_managed_mutex(&raidPtr->shutdownList, (_m_)); \
|
||||
if (rc) { \
|
||||
rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc); \
|
||||
DO_RAID_FAIL(); \
|
||||
return(rc); \
|
||||
} \
|
||||
rf_mutex_init((_m_)); \
|
||||
}
|
||||
|
||||
#define DO_RAID_COND(_c_) { \
|
||||
|
@ -324,12 +319,8 @@ rf_Configure(raidPtr, cfgPtr, ac)
|
|||
RF_LOCK_LKMGR_MUTEX(configureMutex);
|
||||
configureCount++;
|
||||
if (isconfigged == 0) {
|
||||
rc = rf_create_managed_mutex(&globalShutdown, &rf_printf_mutex);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
|
||||
rf_ShutdownList(&globalShutdown);
|
||||
return (rc);
|
||||
}
|
||||
rf_mutex_init(&rf_printf_mutex);
|
||||
|
||||
/* initialize globals */
|
||||
|
||||
DO_INIT_CONFIGURE(rf_ConfigureAllocList);
|
||||
|
@ -827,11 +818,7 @@ rf_InitThroughputStats(
|
|||
int rc;
|
||||
|
||||
/* these used by user-level raidframe only */
|
||||
rc = rf_create_managed_mutex(listp, &raidPtr->throughputstats.mutex);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
|
||||
return (rc);
|
||||
}
|
||||
rf_mutex_init(&raidPtr->throughputstats.mutex);
|
||||
raidPtr->throughputstats.sum_io_us = 0;
|
||||
raidPtr->throughputstats.num_ios = 0;
|
||||
raidPtr->throughputstats.num_out_ios = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_engine.c,v 1.25 2002/10/04 22:56:54 oster Exp $ */
|
||||
/* $NetBSD: rf_engine.c,v 1.26 2003/12/29 05:22:16 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -55,7 +55,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.25 2002/10/04 22:56:54 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.26 2003/12/29 05:22:16 oster Exp $");
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
||||
|
@ -74,10 +74,7 @@ static void rf_RaidIOThread(RF_ThreadArg_t arg);
|
|||
|
||||
#define DO_INIT(_l_,_r_) { \
|
||||
int _rc; \
|
||||
_rc = rf_create_managed_mutex(_l_,&(_r_)->node_queue_mutex); \
|
||||
if (_rc) { \
|
||||
return(_rc); \
|
||||
} \
|
||||
rf_mutex_init(&(_r_)->node_queue_mutex); \
|
||||
_rc = rf_create_managed_cond(_l_,&(_r_)->node_queue_cond); \
|
||||
if (_rc) { \
|
||||
return(_rc); \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_paritylogging.c,v 1.18 2003/12/29 05:01:14 oster Exp $ */
|
||||
/* $NetBSD: rf_paritylogging.c,v 1.19 2003/12/29 05:22:16 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.18 2003/12/29 05:01:14 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.19 2003/12/29 05:22:16 oster Exp $");
|
||||
|
||||
#include "rf_archs.h"
|
||||
|
||||
|
@ -435,12 +435,7 @@ rf_ConfigureParityLogging(
|
|||
return (rc);
|
||||
}
|
||||
/* initialize parityLogDiskQueue */
|
||||
rc = rf_create_managed_mutex(listp,
|
||||
&raidPtr->parityLogDiskQueue.mutex);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
|
||||
return (rc);
|
||||
}
|
||||
rf_mutex_init(&raidPtr->parityLogDiskQueue.mutex);
|
||||
rc = rf_create_managed_cond(listp, &raidPtr->parityLogDiskQueue.cond);
|
||||
if (rc) {
|
||||
rf_print_unable_to_init_cond(__FILE__, __LINE__, rc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_threadstuff.c,v 1.15 2003/12/29 05:09:08 oster Exp $ */
|
||||
/* $NetBSD: rf_threadstuff.c,v 1.16 2003/12/29 05:22:16 oster Exp $ */
|
||||
/*
|
||||
* rf_threadstuff.c
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_threadstuff.c,v 1.15 2003/12/29 05:09:08 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_threadstuff.c,v 1.16 2003/12/29 05:22:16 oster Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -56,19 +56,6 @@ cond_destroyer(arg)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
_rf_create_managed_mutex(listp, m, file, line)
|
||||
RF_ShutdownList_t **listp;
|
||||
RF_DECLARE_MUTEX(*m)
|
||||
char *file;
|
||||
int line;
|
||||
{
|
||||
|
||||
rf_mutex_init(m);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
int
|
||||
_rf_create_managed_lkmgr_mutex(listp, m, file, line)
|
||||
|
@ -125,9 +112,7 @@ _rf_init_managed_threadgroup(listp, g, file, line)
|
|||
{
|
||||
int rc;
|
||||
|
||||
rc = _rf_create_managed_mutex(listp, &g->mutex, file, line);
|
||||
if (rc)
|
||||
return (rc);
|
||||
rf_mutex_init(&g->mutex);
|
||||
rc = _rf_create_managed_cond(listp, &g->cond, file, line);
|
||||
if (rc)
|
||||
return (rc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_threadstuff.h,v 1.15 2003/12/29 05:01:14 oster Exp $ */
|
||||
/* $NetBSD: rf_threadstuff.h,v 1.16 2003/12/29 05:22:16 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -51,7 +51,6 @@
|
|||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
#define rf_create_managed_mutex(a,b) _rf_create_managed_mutex(a,b,__FILE__,__LINE__)
|
||||
#define rf_create_managed_cond(a,b) _rf_create_managed_cond(a,b,__FILE__,__LINE__)
|
||||
#define rf_init_managed_threadgroup(a,b) _rf_init_managed_threadgroup(a,b,__FILE__,__LINE__)
|
||||
#define rf_init_threadgroup(a) _rf_init_threadgroup(a,__FILE__,__LINE__)
|
||||
|
@ -183,10 +182,6 @@ struct RF_ThreadGroup_s {
|
|||
|
||||
#define rf_mutex_init(m) simple_lock_init(m)
|
||||
|
||||
int
|
||||
_rf_create_managed_mutex(RF_ShutdownList_t **, struct simplelock *,
|
||||
char *, int);
|
||||
|
||||
int rf_lkmgr_mutex_init(struct lock *);
|
||||
int rf_lkmgr_mutex_destroy(struct lock *);
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue