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 regionInfo[regionID].mutex to a km...
details: https://anonhg.NetBSD.org/src/rev/f0bf5d53dac8
branches: trunk
changeset: 764898:f0bf5d53dac8
user: mrg <mrg%NetBSD.org@localhost>
date: Wed May 11 05:14:07 2011 +0000
description:
convert regionInfo[regionID].mutex to a kmutex.
diffstat:
sys/dev/raidframe/rf_paritylog.c | 18 ++++++++++--------
sys/dev/raidframe/rf_paritylog.h | 6 +++---
sys/dev/raidframe/rf_paritylogDiskMgr.c | 12 ++++++------
sys/dev/raidframe/rf_paritylogging.c | 9 ++++-----
sys/dev/raidframe/rf_threadstuff.h | 4 +++-
5 files changed, 26 insertions(+), 23 deletions(-)
diffs (202 lines):
diff -r 826d1c5b5218 -r f0bf5d53dac8 sys/dev/raidframe/rf_paritylog.c
--- a/sys/dev/raidframe/rf_paritylog.c Wed May 11 03:38:32 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.c Wed May 11 05:14:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylog.c,v 1.16 2011/05/11 03:38:32 mrg Exp $ */
+/* $NetBSD: rf_paritylog.c,v 1.17 2011/05/11 05:14:07 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.16 2011/05/11 03:38:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.17 2011/05/11 05:14:07 mrg Exp $");
#include "rf_archs.h"
@@ -605,6 +605,8 @@
*
* NON-BLOCKING */
+ RF_ASSERT(rf_owned_mutex2(raidPtr->regionInfo[regionID].mutex));
+
if (rf_parityLogDebug)
printf("[dumping parity log to disk, region %d]\n", regionID);
log = raidPtr->regionInfo[regionID].coreLog;
@@ -689,7 +691,7 @@
/* lock the region for the first item in logData */
RF_ASSERT(logData != NULL);
regionID = logData->regionID;
- RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex);
RF_ASSERT(raidPtr->regionInfo[regionID].loggingEnabled);
if (clearReintFlag) {
@@ -719,9 +721,9 @@
/* see if we moved to a new region */
if (regionID != item->regionID) {
- RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex);
regionID = item->regionID;
- RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex);
RF_ASSERT(raidPtr->regionInfo[regionID].loggingEnabled);
}
punt = RF_FALSE;/* Set to RF_TRUE if work is blocked. This
@@ -845,7 +847,7 @@
FreeParityLogData(item);
}
}
- RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex);
if (rf_parityLogDebug)
printf("[exiting ParityLogAppend]\n");
return (0);
@@ -858,9 +860,9 @@
int regionID;
for (regionID = 0; regionID < rf_numParityRegions; regionID++) {
- RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex);
raidPtr->regionInfo[regionID].loggingEnabled = RF_TRUE;
- RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex);
}
if (rf_parityLogDebug)
printf("[parity logging enabled]\n");
diff -r 826d1c5b5218 -r f0bf5d53dac8 sys/dev/raidframe/rf_paritylog.h
--- a/sys/dev/raidframe/rf_paritylog.h Wed May 11 03:38:32 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.h Wed May 11 05:14:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylog.h,v 1.8 2011/05/11 03:38:32 mrg Exp $ */
+/* $NetBSD: rf_paritylog.h,v 1.9 2011/05/11 05:14:07 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -144,8 +144,8 @@
};
struct RF_RegionInfo_s {
- RF_DECLARE_MUTEX(mutex) /* protects: diskCount, diskMap,
- * loggingEnabled, coreLog */
+ rf_declare_mutex2(mutex); /* protects: diskCount, diskMap,
+ * loggingEnabled, coreLog */
rf_declare_mutex2(reintMutex); /* protects: reintInProgress */
int reintInProgress;/* flag used to suspend flushing operations */
RF_SectorCount_t capacity; /* capacity of this region in sectors */
diff -r 826d1c5b5218 -r f0bf5d53dac8 sys/dev/raidframe/rf_paritylogDiskMgr.c
--- a/sys/dev/raidframe/rf_paritylogDiskMgr.c Wed May 11 03:38:32 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogDiskMgr.c Wed May 11 05:14:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 mrg Exp $ */
+/* $NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 mrg Exp $");
#include "rf_archs.h"
@@ -534,13 +534,13 @@
/* Enable flushing for this region. Holding both
* locks provides a synchronization barrier with
* DumpParityLogToDisk */
- RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex);
rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
/* XXXmrg: don't need this? */
rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
raidPtr->regionInfo[regionID].diskCount = 0;
raidPtr->regionInfo[regionID].reintInProgress = RF_FALSE;
- RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex);
rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex); /* flushing is now
* enabled */
/* XXXmrg: don't need this? */
@@ -573,13 +573,13 @@
* regions. */
if (rf_forceParityLogReint) {
for (regionID = 0; regionID < rf_numParityRegions; regionID++) {
- RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex);
raidPtr->regionInfo[regionID].loggingEnabled =
RF_FALSE;
log = raidPtr->regionInfo[regionID].coreLog;
raidPtr->regionInfo[regionID].coreLog = NULL;
diskCount = raidPtr->regionInfo[regionID].diskCount;
- RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+ rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex);
if (diskCount > 0 || log != NULL)
ReintegrateRegion(raidPtr, regionID, log);
if (log != NULL)
diff -r 826d1c5b5218 -r f0bf5d53dac8 sys/dev/raidframe/rf_paritylogging.c
--- a/sys/dev/raidframe/rf_paritylogging.c Wed May 11 03:38:32 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogging.c Wed May 11 05:14:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylogging.c,v 1.31 2011/05/11 03:38:32 mrg Exp $ */
+/* $NetBSD: rf_paritylogging.c,v 1.32 2011/05/11 05:14:07 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.31 2011/05/11 03:38:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.32 2011/05/11 05:14:07 mrg Exp $");
#include "rf_archs.h"
@@ -410,7 +410,7 @@
rf_ShutdownParityLoggingDiskQueue,
raidPtr);
for (i = 0; i < rf_numParityRegions; i++) {
- rf_mutex_init(&raidPtr->regionInfo[i].mutex);
+ rf_init_mutex2(raidPtr->regionInfo[i].mutex, IPL_VM);
rf_init_mutex2(raidPtr->regionInfo[i].reintMutex, IPL_VM);
raidPtr->regionInfo[i].reintInProgress = RF_FALSE;
raidPtr->regionInfo[i].regionStartAddr =
@@ -500,7 +500,6 @@
RF_Raid_t * raidPtr,
RF_RegionId_t regionID)
{
- RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
RF_Free(raidPtr->regionInfo[regionID].diskMap,
(raidPtr->regionInfo[regionID].capacity *
sizeof(RF_DiskMap_t)));
@@ -512,8 +511,8 @@
RF_ASSERT(raidPtr->regionInfo[regionID].coreLog == NULL);
RF_ASSERT(raidPtr->regionInfo[regionID].diskCount == 0);
}
- RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
rf_destroy_mutex2(raidPtr->regionInfo[regionID].reintMutex);
+ rf_destroy_mutex2(raidPtr->regionInfo[regionID].mutex);
}
diff -r 826d1c5b5218 -r f0bf5d53dac8 sys/dev/raidframe/rf_threadstuff.h
--- a/sys/dev/raidframe/rf_threadstuff.h Wed May 11 03:38:32 2011 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.h Wed May 11 05:14:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_threadstuff.h,v 1.31 2011/05/05 08:21:09 mrg Exp $ */
+/* $NetBSD: rf_threadstuff.h,v 1.32 2011/05/11 05:14:07 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -83,6 +83,8 @@
#define rf_init_mutex2(_m_, _p_) mutex_init(&(_m_), MUTEX_DEFAULT, (_p_))
#define rf_destroy_mutex2(_m_) mutex_destroy(&(_m_))
+#define rf_owned_mutex2(_m_) mutex_owned(&(_m_))
+
#define rf_init_cond2(_c_, _w_) cv_init(&(_c_), (_w_))
#define rf_destroy_cond2(_c_) cv_destroy(&(_c_))
Home |
Main Index |
Thread Index |
Old Index