Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe convert rb_mutex to a kmutex/cv.
details: https://anonhg.NetBSD.org/src/rev/737cfc5cc6fe
branches: trunk
changeset: 764732:737cfc5cc6fe
user: mrg <mrg%NetBSD.org@localhost>
date: Mon May 02 07:29:18 2011 +0000
description:
convert rb_mutex to a kmutex/cv.
diffstat:
sys/dev/raidframe/rf_raid1.c | 16 ++++----
sys/dev/raidframe/rf_reconbuffer.c | 34 +++++++++---------
sys/dev/raidframe/rf_reconstruct.c | 68 +++++++++++++++++++-------------------
sys/dev/raidframe/rf_reconstruct.h | 6 +-
sys/dev/raidframe/rf_reconutil.c | 14 +++++--
5 files changed, 71 insertions(+), 67 deletions(-)
diffs (truncated from 385 to 300 lines):
diff -r bc41eee37b79 -r 737cfc5cc6fe sys/dev/raidframe/rf_raid1.c
--- a/sys/dev/raidframe/rf_raid1.c Mon May 02 07:02:09 2011 +0000
+++ b/sys/dev/raidframe/rf_raid1.c Mon May 02 07:29:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_raid1.c,v 1.33 2011/05/01 01:09:05 mrg Exp $ */
+/* $NetBSD: rf_raid1.c,v 1.34 2011/05/02 07:29:18 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.33 2011/05/01 01:09:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.34 2011/05/02 07:29:18 mrg Exp $");
#include "rf_raid.h"
#include "rf_raid1.h"
@@ -581,12 +581,12 @@
}
RF_LOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID);
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
while(reconCtrlPtr->rb_lock) {
- ltsleep(&reconCtrlPtr->rb_lock, PRIBIO, "reconctlcnmhs", 0, &reconCtrlPtr->rb_mutex);
+ rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex);
}
reconCtrlPtr->rb_lock = 1;
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
pssPtr = rf_LookupRUStatus(raidPtr, reconCtrlPtr->pssTable,
rbuf->parityStripeID, rbuf->which_ru, RF_PSS_NONE, NULL);
@@ -688,10 +688,10 @@
out:
RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID);
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
reconCtrlPtr->rb_lock = 0;
- wakeup(&reconCtrlPtr->rb_lock);
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_broadcast_cond2(reconCtrlPtr->rb_cv);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
#if RF_DEBUG_RECON
if (rf_reconbufferDebug) {
printf("raid%d: RAID1 rbuf submission: returning %d\n",
diff -r bc41eee37b79 -r 737cfc5cc6fe sys/dev/raidframe/rf_reconbuffer.c
--- a/sys/dev/raidframe/rf_reconbuffer.c Mon May 02 07:02:09 2011 +0000
+++ b/sys/dev/raidframe/rf_reconbuffer.c Mon May 02 07:29:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconbuffer.c,v 1.24 2007/03/04 06:02:39 christos Exp $ */
+/* $NetBSD: rf_reconbuffer.c,v 1.25 2011/05/02 07:29:18 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
***************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconbuffer.c,v 1.24 2007/03/04 06:02:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconbuffer.c,v 1.25 2011/05/02 07:29:18 mrg Exp $");
#include "rf_raid.h"
#include "rf_reconbuffer.h"
@@ -140,12 +140,12 @@
RF_LOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID);
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
while(reconCtrlPtr->rb_lock) {
- ltsleep(&reconCtrlPtr->rb_lock, PRIBIO, "reconctlcnmhs", 0, &reconCtrlPtr->rb_mutex);
+ rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex);
}
reconCtrlPtr->rb_lock = 1;
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
pssPtr = rf_LookupRUStatus(raidPtr, reconCtrlPtr->pssTable, rbuf->parityStripeID, rbuf->which_ru, RF_PSS_NONE, NULL);
RF_ASSERT(pssPtr); /* if it didn't exist, we wouldn't have gotten
@@ -193,10 +193,10 @@
}
if (keep_it) {
RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID);
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
reconCtrlPtr->rb_lock = 0;
- wakeup(&reconCtrlPtr->rb_lock);
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_broadcast_cond2(reconCtrlPtr->rb_cv);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
rf_FreeReconBuffer(rbuf);
return (retcode);
}
@@ -286,10 +286,10 @@
out:
RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID);
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
reconCtrlPtr->rb_lock = 0;
- wakeup(&reconCtrlPtr->rb_lock);
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_broadcast_cond2(reconCtrlPtr->rb_cv);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
return (retcode);
}
/* pssPtr - the pss descriptor for this parity stripe */
@@ -339,21 +339,21 @@
{
RF_ReconBuffer_t *p;
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
while(reconCtrlPtr->rb_lock) {
- ltsleep(&reconCtrlPtr->rb_lock, PRIBIO, "reconctlcnmhs", 0, &reconCtrlPtr->rb_mutex);
+ rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex);
}
reconCtrlPtr->rb_lock = 1;
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
if ((p = reconCtrlPtr->fullBufferList) != NULL) {
reconCtrlPtr->fullBufferList = p->next;
p->next = NULL;
}
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
reconCtrlPtr->rb_lock = 0;
- wakeup(&reconCtrlPtr->rb_lock);
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_broadcast_cond2(reconCtrlPtr->rb_cv);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
return (p);
}
diff -r bc41eee37b79 -r 737cfc5cc6fe sys/dev/raidframe/rf_reconstruct.c
--- a/sys/dev/raidframe/rf_reconstruct.c Mon May 02 07:02:09 2011 +0000
+++ b/sys/dev/raidframe/rf_reconstruct.c Mon May 02 07:29:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconstruct.c,v 1.111 2011/02/19 07:11:09 enami Exp $ */
+/* $NetBSD: rf_reconstruct.c,v 1.112 2011/05/02 07:29:18 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.111 2011/02/19 07:11:09 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.112 2011/05/02 07:29:18 mrg Exp $");
#include <sys/param.h>
#include <sys/time.h>
@@ -952,26 +952,26 @@
rbuf->failedDiskSectorOffset, rbuf->failedDiskSectorOffset + sectorsPerRU - 1);
rf_RemoveFromActiveReconTable(raidPtr, rbuf->parityStripeID, rbuf->which_ru);
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_lock_mutex2(raidPtr->reconControl->rb_mutex);
raidPtr->reconControl->pending_writes--;
- RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_unlock_mutex2(raidPtr->reconControl->rb_mutex);
if (rbuf->type == RF_RBUF_TYPE_FLOATING) {
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_lock_mutex2(raidPtr->reconControl->rb_mutex);
while(raidPtr->reconControl->rb_lock) {
- ltsleep(&raidPtr->reconControl->rb_lock, PRIBIO, "reconctrlpre1", 0,
- &raidPtr->reconControl->rb_mutex);
+ rf_wait_cond2(raidPtr->reconControl->rb_cv,
+ raidPtr->reconControl->rb_mutex);
}
raidPtr->reconControl->rb_lock = 1;
- RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_unlock_mutex2(raidPtr->reconControl->rb_mutex);
raidPtr->numFullReconBuffers--;
rf_ReleaseFloatingReconBuffer(raidPtr, rbuf);
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_lock_mutex2(raidPtr->reconControl->rb_mutex);
raidPtr->reconControl->rb_lock = 0;
- wakeup(&raidPtr->reconControl->rb_lock);
- RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_broadcast_cond2(raidPtr->reconControl->rb_cv);
+ rf_unlock_mutex2(raidPtr->reconControl->rb_mutex);
} else
if (rbuf->type == RF_RBUF_TYPE_FORCED)
rf_FreeReconBuffer(rbuf);
@@ -1056,9 +1056,9 @@
/* This is an error, but it was a pending write.
Account for it. */
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_lock_mutex2(raidPtr->reconControl->rb_mutex);
raidPtr->reconControl->pending_writes--;
- RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_unlock_mutex2(raidPtr->reconControl->rb_mutex);
rbuf = (RF_ReconBuffer_t *) event->arg;
@@ -1442,9 +1442,9 @@
(void *) raidPtr, 0, NULL, PR_WAITOK);
rbuf->arg = (void *) req;
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_lock_mutex2(raidPtr->reconControl->rb_mutex);
raidPtr->reconControl->pending_writes++;
- RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_unlock_mutex2(raidPtr->reconControl->rb_mutex);
rf_DiskIOEnqueue(&raidPtr->Queues[rbuf->spCol], req, RF_IO_RECON_PRIORITY);
return (0);
@@ -1531,12 +1531,12 @@
* of a minimum */
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
while(reconCtrlPtr->rb_lock) {
- ltsleep(&reconCtrlPtr->rb_lock, PRIBIO, "reconctlcnmhs", 0, &reconCtrlPtr->rb_mutex);
+ rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex);
}
reconCtrlPtr->rb_lock = 1;
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
new_min = ~(1L << (8 * sizeof(long) - 1)); /* 0x7FFF....FFF */
for (i = 0; i < raidPtr->numCol; i++)
@@ -1559,10 +1559,10 @@
}
}
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
reconCtrlPtr->rb_lock = 0;
- wakeup(&reconCtrlPtr->rb_lock);
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_broadcast_cond2(reconCtrlPtr->rb_cv);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
}
/*
@@ -1594,12 +1594,12 @@
* separation before we'll wake up.
*
*/
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
while(reconCtrlPtr->rb_lock) {
- ltsleep(&reconCtrlPtr->rb_lock, PRIBIO, "reconctlchs", 0, &reconCtrlPtr->rb_mutex);
+ rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex);
}
reconCtrlPtr->rb_lock = 1;
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
if ((raidPtr->headSepLimit >= 0) &&
((ctrl->headSepCounter - reconCtrlPtr->minHeadSepCounter) > raidPtr->headSepLimit)) {
Dprintf5("raid%d: RECON: head sep stall: col %d hsCtr %ld minHSCtr %ld limit %ld\n",
@@ -1632,10 +1632,10 @@
ctrl->reconCtrl->reconDesc->hsStallCount++;
#endif /* RF_RECON_STATS > 0 */
}
- RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_lock_mutex2(reconCtrlPtr->rb_mutex);
reconCtrlPtr->rb_lock = 0;
- wakeup(&reconCtrlPtr->rb_lock);
- RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+ rf_broadcast_cond2(reconCtrlPtr->rb_cv);
+ rf_unlock_mutex2(reconCtrlPtr->rb_mutex);
return (retval);
}
@@ -1878,14 +1878,14 @@
{
RF_CallbackDesc_t *p;
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_lock_mutex2(raidPtr->reconControl->rb_mutex);
while(raidPtr->reconControl->rb_lock) {
- ltsleep(&raidPtr->reconControl->rb_lock, PRIBIO,
- "rf_wakeuphscbw", 0, &raidPtr->reconControl->rb_mutex);
+ rf_wait_cond2(raidPtr->reconControl->rb_cv,
+ raidPtr->reconControl->rb_mutex);
}
raidPtr->reconControl->rb_lock = 1;
- RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
+ rf_unlock_mutex2(raidPtr->reconControl->rb_mutex);
while (raidPtr->reconControl->headSepCBList) {
p = raidPtr->reconControl->headSepCBList;
@@ -1894,10 +1894,10 @@
rf_CauseReconEvent(raidPtr, p->col, NULL, RF_REVENT_HEADSEPCLEAR);
rf_FreeCallbackDesc(p);
}
- RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
Home |
Main Index |
Thread Index |
Old Index