Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe _rf_create_managed_mutex() is doing just a...
details: https://anonhg.NetBSD.org/src/rev/e7e257ddd8db
branches: trunk
changeset: 556863:e7e257ddd8db
user: oster <oster%NetBSD.org@localhost>
date: Mon Dec 29 05:22:16 2003 +0000
description:
_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!)
diffstat:
sys/dev/raidframe/rf_debugMem.c | 10 +++-------
sys/dev/raidframe/rf_diskqueue.c | 10 +++-------
sys/dev/raidframe/rf_driver.c | 25 ++++++-------------------
sys/dev/raidframe/rf_engine.c | 9 +++------
sys/dev/raidframe/rf_paritylogging.c | 11 +++--------
sys/dev/raidframe/rf_threadstuff.c | 21 +++------------------
sys/dev/raidframe/rf_threadstuff.h | 7 +------
7 files changed, 22 insertions(+), 71 deletions(-)
diffs (261 lines):
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_debugMem.c
--- a/sys/dev/raidframe/rf_debugMem.c Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_debugMem.c Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
#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;
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_diskqueue.c
--- a/sys/dev/raidframe/rf_diskqueue.c Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_diskqueue.c Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
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);
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_driver.c
--- a/sys/dev/raidframe/rf_driver.c Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_driver.c Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
}
#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_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 @@
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;
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_engine.c
--- a/sys/dev/raidframe/rf_engine.c Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_engine.c Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
#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); \
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_paritylogging.c
--- a/sys/dev/raidframe/rf_paritylogging.c Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_paritylogging.c Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
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);
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_threadstuff.c
--- a/sys/dev/raidframe/rf_threadstuff.c Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.c Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
}
}
-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 @@
{
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);
diff -r 8b2d312f705b -r e7e257ddd8db sys/dev/raidframe/rf_threadstuff.h
--- a/sys/dev/raidframe/rf_threadstuff.h Mon Dec 29 05:09:08 2003 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.h Mon Dec 29 05:22:16 2003 +0000
@@ -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 @@
#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
Home |
Main Index |
Thread Index |
Old Index