diff options
| author | mrg <mrg@NetBSD.org> | 2011-04-30 01:44:36 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2011-04-30 01:44:36 +0000 |
| commit | 3190ca484048508ee0734ae0655dfdb374722307 (patch) | |
| tree | fad8e7ca2a052ddbad9f8837aee27cc42d9cdde8 /sys/dev/raidframe | |
| parent | 06fac52f6d7c00610743bb7ac00d46cdad142c52 (diff) | |
- convert rf_printf_mutex to a kmutex
- convert rf_rad_lock and the per-raid "cv" to per-raid kmutex/and real cv
- use rf_mutex_init() in places, and move it with the similar definitions
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_driver.c | 36 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_driver.h | 4 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_mcpair.c | 6 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_raid.h | 5 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_reconutil.c | 8 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_stripelocks.c | 8 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_threadstuff.h | 6 |
7 files changed, 38 insertions, 35 deletions
diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 952a4e17d30..fd8d8e2a290 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.125 2011/04/27 07:55:14 mrg Exp $ */ +/* $NetBSD: rf_driver.c,v 1.126 2011/04/30 01:44:36 mrg Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.125 2011/04/27 07:55:14 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.126 2011/04/30 01:44:36 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -118,7 +118,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.125 2011/04/27 07:55:14 mrg Exp $"); #endif /* rad == RF_RaidAccessDesc_t */ -RF_DECLARE_MUTEX(rf_rad_lock) #define RF_MAX_FREE_RAD 128 #define RF_MIN_FREE_RAD 32 @@ -134,7 +133,7 @@ static void rf_UnconfigureArray(void); static void rf_ShutdownRDFreeList(void *); static int rf_ConfigureRDFreeList(RF_ShutdownList_t **); -RF_DECLARE_MUTEX(rf_printf_mutex) /* debug only: avoids interleaved +rf_declare_mutex2(rf_printf_mutex); /* debug only: avoids interleaved * printfs by different stripes */ #define SIGNAL_QUIESCENT_COND(_raid_) wakeup(&((_raid_)->accesses_suspended)) @@ -213,16 +212,16 @@ rf_Shutdown(RF_Raid_t *raidPtr) * cuts down on the amount of serialization we've got going * on. */ - RF_LOCK_MUTEX(rf_rad_lock); + rf_lock_mutex2(raidPtr->rad_lock); if (raidPtr->waitShutdown) { - RF_UNLOCK_MUTEX(rf_rad_lock); + rf_unlock_mutex2(raidPtr->rad_lock); return (EBUSY); } raidPtr->waitShutdown = 1; while (raidPtr->nAccOutstanding) { - RF_WAIT_COND(raidPtr->outstandingCond, rf_rad_lock); + rf_wait_cond2(raidPtr->outstandingCond, raidPtr->rad_lock); } - RF_UNLOCK_MUTEX(rf_rad_lock); + rf_unlock_mutex2(raidPtr->rad_lock); /* Wait for any parity re-writes to stop... */ while (raidPtr->parity_rewrite_in_progress) { @@ -253,6 +252,9 @@ rf_Shutdown(RF_Raid_t *raidPtr) rf_ShutdownList(&raidPtr->shutdownList); + rf_destroy_cond2(raidPtr->outstandingCond); + rf_destroy_mutex2(raidPtr->rad_lock); + rf_UnconfigureArray(); return (0); @@ -299,7 +301,7 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) rf_lock_mutex2(configureMutex); configureCount++; if (isconfigged == 0) { - rf_mutex_init(&rf_printf_mutex); + rf_init_mutex2(rf_printf_mutex, IPL_VM); /* initialize globals */ @@ -353,7 +355,8 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) DO_RAID_INIT_CONFIGURE(rf_ConfigureEngine); DO_RAID_INIT_CONFIGURE(rf_ConfigureStripeLocks); - raidPtr->outstandingCond = 0; + rf_init_cond2(raidPtr->outstandingCond, "rfocond"); + rf_init_mutex2(raidPtr->rad_lock, IPL_VM); raidPtr->nAccOutstanding = 0; raidPtr->waitShutdown = 0; @@ -544,7 +547,6 @@ rf_ConfigureRDFreeList(RF_ShutdownList_t **listp) 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_lock); return (0); } @@ -558,20 +560,20 @@ rf_AllocRaidAccDesc(RF_Raid_t *raidPtr, RF_IoType_t type, desc = pool_get(&rf_pools.rad, PR_WAITOK); - RF_LOCK_MUTEX(rf_rad_lock); + rf_lock_mutex2(raidPtr->rad_lock); if (raidPtr->waitShutdown) { /* * Actually, we're shutting the array down. Free the desc * and return NULL. */ - RF_UNLOCK_MUTEX(rf_rad_lock); + rf_unlock_mutex2(raidPtr->rad_lock); pool_put(&rf_pools.rad, desc); return (NULL); } raidPtr->nAccOutstanding++; - RF_UNLOCK_MUTEX(rf_rad_lock); + rf_unlock_mutex2(raidPtr->rad_lock); desc->raidPtr = (void *) raidPtr; desc->type = type; @@ -628,12 +630,12 @@ rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *desc) } pool_put(&rf_pools.rad, desc); - RF_LOCK_MUTEX(rf_rad_lock); + rf_lock_mutex2(raidPtr->rad_lock); raidPtr->nAccOutstanding--; if (raidPtr->waitShutdown) { - RF_SIGNAL_COND(raidPtr->outstandingCond); + rf_signal_cond2(raidPtr->outstandingCond); } - RF_UNLOCK_MUTEX(rf_rad_lock); + rf_unlock_mutex2(raidPtr->rad_lock); } /********************************************************************* * Main routine for performing an access. diff --git a/sys/dev/raidframe/rf_driver.h b/sys/dev/raidframe/rf_driver.h index dbd58e24221..04874eb4fa1 100644 --- a/sys/dev/raidframe/rf_driver.h +++ b/sys/dev/raidframe/rf_driver.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.h,v 1.18 2011/04/27 07:55:15 mrg Exp $ */ +/* $NetBSD: rf_driver.h,v 1.19 2011/04/30 01:44:36 mrg Exp $ */ /* * rf_driver.h */ @@ -41,7 +41,7 @@ #define RF_RETRY_THRESHOLD 5 #endif -extern RF_DECLARE_MUTEX(rf_printf_mutex); +extern rf_declare_mutex2(rf_printf_mutex); int rf_BootRaidframe(void); int rf_UnbootRaidframe(void); int rf_Shutdown(RF_Raid_t *); diff --git a/sys/dev/raidframe/rf_mcpair.c b/sys/dev/raidframe/rf_mcpair.c index 363bf7efee8..657968b86f2 100644 --- a/sys/dev/raidframe/rf_mcpair.c +++ b/sys/dev/raidframe/rf_mcpair.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_mcpair.c,v 1.22 2009/03/15 17:17:23 cegger Exp $ */ +/* $NetBSD: rf_mcpair.c,v 1.23 2011/04/30 01:44:36 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.22 2009/03/15 17:17:23 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.23 2011/04/30 01:44:36 mrg Exp $"); #include <dev/raidframe/raidframevar.h> @@ -75,7 +75,7 @@ rf_AllocMCPair(void) RF_MCPair_t *t; t = pool_get(&rf_pools.mcpair, PR_WAITOK); - simple_lock_init(&t->mutex); + rf_mutex_init(&t->mutex); t->cond = 0; t->flag = 0; diff --git a/sys/dev/raidframe/rf_raid.h b/sys/dev/raidframe/rf_raid.h index ae76fa9662c..bcda587761a 100644 --- a/sys/dev/raidframe/rf_raid.h +++ b/sys/dev/raidframe/rf_raid.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid.h,v 1.40 2011/04/27 07:55:15 mrg Exp $ */ +/* $NetBSD: rf_raid.h,v 1.41 2011/04/30 01:44:36 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -249,7 +249,8 @@ struct RF_Raid_s { * for a per-array piece of data, but otherwise, it'd be an extra * per-array lock, and that'd only be less efficient...) */ - RF_DECLARE_COND(outstandingCond) + rf_declare_mutex2(rad_lock); + rf_declare_cond2(outstandingCond); int waitShutdown; int nAccOutstanding; diff --git a/sys/dev/raidframe/rf_reconutil.c b/sys/dev/raidframe/rf_reconutil.c index 6748e91d546..9e488b97b5b 100644 --- a/sys/dev/raidframe/rf_reconutil.c +++ b/sys/dev/raidframe/rf_reconutil.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconutil.c,v 1.28 2007/03/04 06:02:39 christos Exp $ */ +/* $NetBSD: rf_reconutil.c,v 1.29 2011/04/30 01:44:36 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ ********************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.28 2007/03/04 06:02:39 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.29 2011/04/30 01:44:36 mrg Exp $"); #include <dev/raidframe/raidframevar.h> @@ -125,13 +125,13 @@ rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc, } /* initialize the event queue */ - simple_lock_init(&reconCtrlPtr->eq_mutex); + rf_mutex_init(&reconCtrlPtr->eq_mutex); reconCtrlPtr->eventQueue = NULL; reconCtrlPtr->eq_count = 0; /* make the floating recon buffers and append them to the free list */ - simple_lock_init(&reconCtrlPtr->rb_mutex); + rf_mutex_init(&reconCtrlPtr->rb_mutex); reconCtrlPtr->fullBufferList = NULL; reconCtrlPtr->floatingRbufs = NULL; diff --git a/sys/dev/raidframe/rf_stripelocks.c b/sys/dev/raidframe/rf_stripelocks.c index e0cc945751b..697dfdca476 100644 --- a/sys/dev/raidframe/rf_stripelocks.c +++ b/sys/dev/raidframe/rf_stripelocks.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_stripelocks.c,v 1.30 2009/03/15 17:17:23 cegger Exp $ */ +/* $NetBSD: rf_stripelocks.c,v 1.31 2011/04/30 01:44:36 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.30 2009/03/15 17:17:23 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.31 2011/04/30 01:44:36 mrg Exp $"); #include <dev/raidframe/raidframevar.h> @@ -658,7 +658,7 @@ PrintLockedStripes(RF_LockTableEntry_t *lockTable) RF_StripeLockDesc_t *p; RF_LockReqDesc_t *q; - RF_LOCK_MUTEX(rf_printf_mutex); + rf_lock_mutex2(rf_printf_mutex); printf("Locked stripes:\n"); for (i = 0; i < rf_lockTableSize; i++) if (lockTable[i].descList) { @@ -714,6 +714,6 @@ PrintLockedStripes(RF_LockTableEntry_t *lockTable) printf("(none)\n"); else printf("\n"); - RF_UNLOCK_MUTEX(rf_printf_mutex); + rf_unlock_mutex2(rf_printf_mutex); } #endif diff --git a/sys/dev/raidframe/rf_threadstuff.h b/sys/dev/raidframe/rf_threadstuff.h index 9ed8501eeb8..c27de0accd3 100644 --- a/sys/dev/raidframe/rf_threadstuff.h +++ b/sys/dev/raidframe/rf_threadstuff.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_threadstuff.h,v 1.25 2011/04/27 07:55:15 mrg Exp $ */ +/* $NetBSD: rf_threadstuff.h,v 1.26 2011/04/30 01:44:36 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -70,6 +70,8 @@ typedef void *RF_ThreadArg_t; #define RF_SIGNAL_COND(_c_) wakeup_one(&(_c_)) #define RF_BROADCAST_COND(_c_) wakeup(&(_c_)) +#define rf_mutex_init(m) simple_lock_init(m) + /* Modern mutex */ /* Note that rf_declare_{mutex,cond}2() do _NOT_ append the ; */ @@ -102,6 +104,4 @@ typedef void *RF_ThreadArg_t; kthread_create(PRI_NONE, 0, NULL, (void (*)(void *))(_func_), \ (void *)(_arg_), &(_handle_), _fmt_, _fmt_arg_) -#define rf_mutex_init(m) simple_lock_init(m) - #endif /* !_RF__RF_THREADSTUFF_H_ */ |
