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 parityLogPool.mutex to a kmutex.
details: https://anonhg.NetBSD.org/src/rev/514a0fc66f89
branches: trunk
changeset: 764899:514a0fc66f89
user: mrg <mrg%NetBSD.org@localhost>
date: Wed May 11 06:03:06 2011 +0000
description:
convert parityLogPool.mutex to a kmutex.
diffstat:
sys/dev/raidframe/rf_paritylog.c | 16 ++++++++--------
sys/dev/raidframe/rf_paritylog.h | 4 ++--
sys/dev/raidframe/rf_paritylogging.c | 17 +++++++----------
3 files changed, 17 insertions(+), 20 deletions(-)
diffs (152 lines):
diff -r f0bf5d53dac8 -r 514a0fc66f89 sys/dev/raidframe/rf_paritylog.c
--- a/sys/dev/raidframe/rf_paritylog.c Wed May 11 05:14:07 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.c Wed May 11 06:03:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylog.c,v 1.17 2011/05/11 05:14:07 mrg Exp $ */
+/* $NetBSD: rf_paritylog.c,v 1.18 2011/05/11 06:03:06 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.17 2011/05/11 05:14:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.18 2011/05/11 06:03:06 mrg Exp $");
#include "rf_archs.h"
@@ -436,7 +436,7 @@
/* Grab a log buffer from the pool and return it. If no buffers are
* available, return NULL. NON-BLOCKING */
raidPtr = logData->common->raidPtr;
- RF_LOCK_MUTEX(raidPtr->parityLogPool.mutex);
+ rf_lock_mutex2(raidPtr->parityLogPool.mutex);
if (raidPtr->parityLogPool.parityLogs) {
log = raidPtr->parityLogPool.parityLogs;
raidPtr->parityLogPool.parityLogs = raidPtr->parityLogPool.parityLogs->next;
@@ -457,7 +457,7 @@
else
EnqueueParityLogData(logData, &raidPtr->parityLogDiskQueue.logBlockHead, &raidPtr->parityLogDiskQueue.logBlockTail);
}
- RF_UNLOCK_MUTEX(raidPtr->parityLogPool.mutex);
+ rf_unlock_mutex2(raidPtr->parityLogPool.mutex);
return (log);
}
@@ -480,7 +480,7 @@
/* Before returning logs to global free list, service all requests
* which are blocked on logs. Holding mutexes for parityLogPool and
* parityLogDiskQueue forces synchronization with AcquireParityLog(). */
- RF_LOCK_MUTEX(raidPtr->parityLogPool.mutex);
+ rf_lock_mutex2(raidPtr->parityLogPool.mutex);
rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
logDataList = DequeueMatchingLogData(raidPtr, &raidPtr->parityLogDiskQueue.logBlockHead, &raidPtr->parityLogDiskQueue.logBlockTail);
log = firstLog;
@@ -489,7 +489,7 @@
log->numRecords = 0;
log->next = NULL;
while (logDataList && log) {
- RF_UNLOCK_MUTEX(raidPtr->parityLogPool.mutex);
+ rf_unlock_mutex2(raidPtr->parityLogPool.mutex);
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
rf_ParityLogAppend(logDataList, RF_TRUE, &log, RF_FALSE);
if (rf_parityLogDebug)
@@ -502,7 +502,7 @@
log->next = NULL;
}
}
- RF_LOCK_MUTEX(raidPtr->parityLogPool.mutex);
+ rf_lock_mutex2(raidPtr->parityLogPool.mutex);
rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
if (log)
logDataList = DequeueMatchingLogData(raidPtr, &raidPtr->parityLogDiskQueue.logBlockHead, &raidPtr->parityLogDiskQueue.logBlockTail);
@@ -531,7 +531,7 @@
}
RF_ASSERT(cnt + raidPtr->logsInUse == raidPtr->numParityLogs);
}
- RF_UNLOCK_MUTEX(raidPtr->parityLogPool.mutex);
+ rf_unlock_mutex2(raidPtr->parityLogPool.mutex);
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
}
diff -r f0bf5d53dac8 -r 514a0fc66f89 sys/dev/raidframe/rf_paritylog.h
--- a/sys/dev/raidframe/rf_paritylog.h Wed May 11 05:14:07 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.h Wed May 11 06:03:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylog.h,v 1.9 2011/05/11 05:14:07 mrg Exp $ */
+/* $NetBSD: rf_paritylog.h,v 1.10 2011/05/11 06:03:06 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -89,7 +89,7 @@
};
struct RF_ParityLogQueue_s {
- RF_DECLARE_MUTEX(mutex)
+ rf_declare_mutex2(mutex);
RF_ParityLog_t *parityLogs;
};
diff -r f0bf5d53dac8 -r 514a0fc66f89 sys/dev/raidframe/rf_paritylogging.c
--- a/sys/dev/raidframe/rf_paritylogging.c Wed May 11 05:14:07 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogging.c Wed May 11 06:03:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylogging.c,v 1.32 2011/05/11 05:14:07 mrg Exp $ */
+/* $NetBSD: rf_paritylogging.c,v 1.33 2011/05/11 06:03:06 mrg 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.32 2011/05/11 05:14:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.33 2011/05/11 06:03:06 mrg Exp $");
#include "rf_archs.h"
@@ -234,7 +234,7 @@
if (raidPtr->parityLogBufferHeap == NULL)
return (ENOMEM);
lHeapPtr = raidPtr->parityLogBufferHeap;
- rf_mutex_init(&raidPtr->parityLogPool.mutex);
+ rf_init_mutex2(raidPtr->parityLogPool.mutex, IPL_VM);
for (i = 0; i < raidPtr->numParityLogs; i++) {
if (i == 0) {
RF_Malloc(raidPtr->parityLogPool.parityLogs,
@@ -517,14 +517,11 @@
static void
-FreeParityLogQueue(
- RF_Raid_t * raidPtr,
- RF_ParityLogQueue_t * queue)
+FreeParityLogQueue(RF_Raid_t * raidPtr)
{
RF_ParityLog_t *l1, *l2;
- RF_LOCK_MUTEX(queue->mutex);
- l1 = queue->parityLogs;
+ l1 = raidPtr->parityLogPool.parityLogs;
while (l1) {
l2 = l1;
l1 = l2->next;
@@ -532,7 +529,7 @@
sizeof(RF_ParityLogRecord_t)));
RF_Free(l2, sizeof(RF_ParityLog_t));
}
- RF_UNLOCK_MUTEX(queue->mutex);
+ rf_destroy_mutex2(raidPtr->parityLogPool.mutex);
}
@@ -581,7 +578,7 @@
printf("raid%d: ShutdownParityLoggingPool\n", raidPtr->raidid);
}
/* free contents of parityLogPool */
- FreeParityLogQueue(raidPtr, &raidPtr->parityLogPool);
+ FreeParityLogQueue(raidPtr);
RF_Free(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs *
raidPtr->numSectorsPerLog * raidPtr->bytesPerSector);
}
Home |
Main Index |
Thread Index |
Old Index