diff options
| author | mrg <mrg@NetBSD.org> | 2011-05-03 08:18:43 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2011-05-03 08:18:43 +0000 |
| commit | 5e53798d76f15a78c48501a10ef405d31a5cec7e (patch) | |
| tree | e487cfa189c5af49a85de550d0d539bac60ad20f /sys/dev/raidframe | |
| parent | ea11899c3f1fa72cab12a9ecb81dd7bc51dfb527 (diff) | |
convert the pssTable mutex into a kmutex/cv.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_psstatus.c | 23 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_psstatus.h | 24 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_threadstuff.h | 6 |
3 files changed, 29 insertions, 24 deletions
diff --git a/sys/dev/raidframe/rf_psstatus.c b/sys/dev/raidframe/rf_psstatus.c index 3c77aec6355..b3bc5380e89 100644 --- a/sys/dev/raidframe/rf_psstatus.c +++ b/sys/dev/raidframe/rf_psstatus.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_psstatus.c,v 1.33 2006/11/16 01:33:23 christos Exp $ */ +/* $NetBSD: rf_psstatus.c,v 1.34 2011/05/03 08:18:43 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.33 2006/11/16 01:33:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.34 2011/05/03 08:18:43 mrg Exp $"); #include <dev/raidframe/raidframevar.h> @@ -106,7 +106,8 @@ rf_MakeParityStripeStatusTable(RF_Raid_t *raidPtr) raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t), (RF_PSStatusHeader_t *)); for (i = 0; i < raidPtr->pssTableSize; i++) { - rf_mutex_init(&pssTable[i].mutex); + rf_init_mutex2(pssTable[i].mutex, IPL_VM); + rf_init_cond2(pssTable[i].cond, "rfpsslk"); } return (pssTable); } @@ -115,9 +116,9 @@ void rf_FreeParityStripeStatusTable(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable) { -#if RF_DEBUG_PSS int i; +#if RF_DEBUG_PSS if (rf_pssDebug) RealPrintPSStatusTable(raidPtr, pssTable); @@ -127,6 +128,10 @@ rf_FreeParityStripeStatusTable(RF_Raid_t *raidPtr, } } #endif + for (i = 0; i < raidPtr->pssTableSize; i++) { + rf_destroy_mutex2(pssTable[i].mutex); + rf_destroy_cond2(pssTable[i].cond); + } RF_Free(pssTable, raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t)); } @@ -219,12 +224,12 @@ rf_RemoveFromActiveReconTable(RF_Raid_t *raidPtr, RF_StripeNum_t psid, RF_ReconParityStripeStatus_t *p, *pt; RF_CallbackDesc_t *cb, *cb1; - RF_LOCK_MUTEX(hdr->mutex); + rf_lock_mutex2(hdr->mutex); while(hdr->lock) { - ltsleep(&hdr->lock, PRIBIO, "rf_racrecon", 0, &hdr->mutex); + rf_wait_cond2(hdr->cond, hdr->mutex); } hdr->lock = 1; - RF_UNLOCK_MUTEX(hdr->mutex); + rf_unlock_mutex2(hdr->mutex); for (pt = NULL, p = hdr->chain; p; pt = p, p = p->next) { if ((p->parityStripeID == psid) && (p->which_ru == which_ru)) break; @@ -243,9 +248,9 @@ rf_RemoveFromActiveReconTable(RF_Raid_t *raidPtr, RF_StripeNum_t psid, hdr->chain = p->next; p->next = NULL; - RF_LOCK_MUTEX(hdr->mutex); + rf_lock_mutex2(hdr->mutex); hdr->lock = 0; - RF_UNLOCK_MUTEX(hdr->mutex); + rf_unlock_mutex2(hdr->mutex); /* wakup anyone waiting on the parity stripe ID */ cb = p->procWaitList; diff --git a/sys/dev/raidframe/rf_psstatus.h b/sys/dev/raidframe/rf_psstatus.h index 66f435f43f9..1f88d85c728 100644 --- a/sys/dev/raidframe/rf_psstatus.h +++ b/sys/dev/raidframe/rf_psstatus.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_psstatus.h,v 1.13 2006/02/14 01:13:33 oster Exp $ */ +/* $NetBSD: rf_psstatus.h,v 1.14 2011/05/03 08:18:43 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -56,21 +56,20 @@ #define RF_HASH_PSID(_raid_,_psid_) ( (_psid_) % ((_raid_)->pssTableSize) ) /* simple hash function */ #define RF_LOCK_PSS_MUTEX(_raidPtr, _psid) \ do { \ - RF_LOCK_MUTEX((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); \ + rf_lock_mutex2((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); \ while((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].lock) { \ - ltsleep(&(_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].lock, \ - PRIBIO, "rflockpss", 0, \ - &(_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); \ + rf_wait_cond2((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].cond,\ + (_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex);\ } \ (_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].lock = 1; \ - RF_UNLOCK_MUTEX((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); \ + rf_unlock_mutex2((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex);\ } while (0); #define RF_UNLOCK_PSS_MUTEX(_raidPtr, _psid) \ - RF_LOCK_MUTEX((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); \ + rf_lock_mutex2((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); \ (_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].lock = 0; \ - wakeup(&(_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].lock); \ - RF_UNLOCK_MUTEX((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); + rf_broadcast_cond2((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].cond); \ + rf_unlock_mutex2((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex); struct RF_ReconParityStripeStatus_s { RF_StripeNum_t parityStripeID; /* the parity stripe ID */ @@ -99,9 +98,10 @@ struct RF_ReconParityStripeStatus_s { }; struct RF_PSStatusHeader_s { - RF_DECLARE_MUTEX(mutex) /* mutex for this hash chain */ - int lock; /* 1 if this hash chain is locked, - 0 otherwise */ + rf_declare_mutex2(mutex); /* mutex for this hash chain */ + rf_declare_cond2(cond); /* and cv for it */ + int lock; /* 1 if this hash chain is locked, + 0 otherwise */ RF_ReconParityStripeStatus_t *chain; /* the hash chain */ }; /* masks for the "flags" field above */ diff --git a/sys/dev/raidframe/rf_threadstuff.h b/sys/dev/raidframe/rf_threadstuff.h index c957f3121db..92b21984a47 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.29 2011/05/02 01:07:24 mrg Exp $ */ +/* $NetBSD: rf_threadstuff.h,v 1.30 2011/05/03 08:18:43 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -100,11 +100,11 @@ typedef void *RF_ThreadArg_t; */ #define RF_CREATE_THREAD(_handle_, _func_, _arg_, _name_) \ - kthread_create(PRI_NONE, 0, NULL, (void (*)(void *))(_func_), \ + kthread_create(PRI_SOFTBIO, 0, NULL, (void (*)(void *))(_func_), \ (void *)(_arg_), &(_handle_), _name_) #define RF_CREATE_ENGINE_THREAD(_handle_, _func_, _arg_, _fmt_, _fmt_arg_) \ - kthread_create(PRI_NONE, 0, NULL, (void (*)(void *))(_func_), \ + kthread_create(PRI_SOFTBIO, 0, NULL, (void (*)(void *))(_func_), \ (void *)(_arg_), &(_handle_), _fmt_, _fmt_arg_) #endif /* !_RF__RF_THREADSTUFF_H_ */ |
