Module Name:    src
Committed By:   mrg
Date:           Wed May 11 06:03:06 UTC 2011

Modified Files:
        src/sys/dev/raidframe: rf_paritylog.c rf_paritylog.h rf_paritylogging.c

Log Message:
convert parityLogPool.mutex to a kmutex.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_paritylog.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_paritylog.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_paritylogging.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/raidframe/rf_paritylog.c
diff -u src/sys/dev/raidframe/rf_paritylog.c:1.17 src/sys/dev/raidframe/rf_paritylog.c:1.18
--- src/sys/dev/raidframe/rf_paritylog.c:1.17	Wed May 11 05:14:07 2011
+++ src/sys/dev/raidframe/rf_paritylog.c	Wed May 11 06:03:06 2011
@@ -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);
 }
 

Index: src/sys/dev/raidframe/rf_paritylog.h
diff -u src/sys/dev/raidframe/rf_paritylog.h:1.9 src/sys/dev/raidframe/rf_paritylog.h:1.10
--- src/sys/dev/raidframe/rf_paritylog.h:1.9	Wed May 11 05:14:07 2011
+++ src/sys/dev/raidframe/rf_paritylog.h	Wed May 11 06:03:06 2011
@@ -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;
 };
 

Index: src/sys/dev/raidframe/rf_paritylogging.c
diff -u src/sys/dev/raidframe/rf_paritylogging.c:1.32 src/sys/dev/raidframe/rf_paritylogging.c:1.33
--- src/sys/dev/raidframe/rf_paritylogging.c:1.32	Wed May 11 05:14:07 2011
+++ src/sys/dev/raidframe/rf_paritylogging.c	Wed May 11 06:03:06 2011
@@ -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);
 }

Reply via email to