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

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

Log Message:
convert regionBufferPool.mutex/cond and parityBufferPool.mutex/cond
to kmutex/cv.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_paritylog.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/raidframe/rf_paritylogDiskMgr.c
cvs rdiff -u -r1.33 -r1.34 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.h
diff -u src/sys/dev/raidframe/rf_paritylog.h:1.10 src/sys/dev/raidframe/rf_paritylog.h:1.11
--- src/sys/dev/raidframe/rf_paritylog.h:1.10	Wed May 11 06:03:06 2011
+++ src/sys/dev/raidframe/rf_paritylog.h	Wed May 11 06:20:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylog.h,v 1.10 2011/05/11 06:03:06 mrg Exp $	*/
+/*	$NetBSD: rf_paritylog.h,v 1.11 2011/05/11 06:20:33 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -94,8 +94,8 @@
 };
 
 struct RF_RegionBufferQueue_s {
-	RF_DECLARE_MUTEX(mutex)
-	RF_DECLARE_COND(cond)
+	rf_declare_mutex2(mutex);
+	rf_declare_cond2(cond);
 	int     bufferSize;
 	int     totalBuffers;	/* size of array 'buffers' */
 	int     availableBuffers;	/* num available 'buffers' */

Index: src/sys/dev/raidframe/rf_paritylogDiskMgr.c
diff -u src/sys/dev/raidframe/rf_paritylogDiskMgr.c:1.27 src/sys/dev/raidframe/rf_paritylogDiskMgr.c:1.28
--- src/sys/dev/raidframe/rf_paritylogDiskMgr.c:1.27	Wed May 11 05:14:07 2011
+++ src/sys/dev/raidframe/rf_paritylogDiskMgr.c	Wed May 11 06:20:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 mrg Exp $	*/
+/*	$NetBSD: rf_paritylogDiskMgr.c,v 1.28 2011/05/11 06:20:33 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.27 2011/05/11 05:14:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.28 2011/05/11 06:20:33 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -67,18 +67,18 @@
 	/* Return a region buffer from the free list (pool). If the free list
 	 * is empty, WAIT. BLOCKING */
 
-	RF_LOCK_MUTEX(pool->mutex);
+	rf_lock_mutex2(pool->mutex);
 	if (pool->availableBuffers > 0) {
 		bufPtr = pool->buffers[pool->availBuffersIndex];
 		pool->availableBuffers--;
 		pool->availBuffersIndex++;
 		if (pool->availBuffersIndex == pool->totalBuffers)
 			pool->availBuffersIndex = 0;
-		RF_UNLOCK_MUTEX(pool->mutex);
+		rf_unlock_mutex2(pool->mutex);
 	} else {
 		RF_PANIC();	/* should never happen in correct config,
 				 * single reint */
-		RF_WAIT_COND(pool->cond, pool->mutex);
+		rf_wait_cond2(pool->cond, pool->mutex);
 	}
 	return (bufPtr);
 }
@@ -91,15 +91,18 @@
 	/* Insert a region buffer (bufPtr) into the free list (pool).
 	 * NON-BLOCKING */
 
-	RF_LOCK_MUTEX(pool->mutex);
+	rf_lock_mutex2(pool->mutex);
 	pool->availableBuffers++;
 	pool->buffers[pool->emptyBuffersIndex] = bufPtr;
 	pool->emptyBuffersIndex++;
 	if (pool->emptyBuffersIndex == pool->totalBuffers)
 		pool->emptyBuffersIndex = 0;
 	RF_ASSERT(pool->availableBuffers <= pool->totalBuffers);
-	RF_UNLOCK_MUTEX(pool->mutex);
-	RF_SIGNAL_COND(pool->cond);
+	/*
+	 * XXXmrg this signal goes with the above "shouldn't happen" wait?
+	 */
+	rf_signal_cond2(pool->cond);
+	rf_unlock_mutex2(pool->mutex);
 }
 
 

Index: src/sys/dev/raidframe/rf_paritylogging.c
diff -u src/sys/dev/raidframe/rf_paritylogging.c:1.33 src/sys/dev/raidframe/rf_paritylogging.c:1.34
--- src/sys/dev/raidframe/rf_paritylogging.c:1.33	Wed May 11 06:03:06 2011
+++ src/sys/dev/raidframe/rf_paritylogging.c	Wed May 11 06:20:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylogging.c,v 1.33 2011/05/11 06:03:06 mrg Exp $	*/
+/*	$NetBSD: rf_paritylogging.c,v 1.34 2011/05/11 06:20:33 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.33 2011/05/11 06:03:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.34 2011/05/11 06:20:33 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -293,8 +293,8 @@
 	}
 	rf_ShutdownCreate(listp, rf_ShutdownParityLoggingPool, raidPtr);
 	/* build pool of region buffers */
-	rf_mutex_init(&raidPtr->regionBufferPool.mutex);
-	raidPtr->regionBufferPool.cond = 0;
+	rf_init_mutex2(raidPtr->regionBufferPool.mutex, IPL_VM);
+	rf_init_cond2(raidPtr->regionBufferPool.cond, "rfrbpl");
 	raidPtr->regionBufferPool.bufferSize = raidPtr->regionLogCapacity *
 		raidPtr->bytesPerSector;
 	printf("regionBufferPool.bufferSize %d\n",
@@ -342,8 +342,8 @@
 			  raidPtr);
 	/* build pool of parity buffers */
 	parityBufferCapacity = maxRegionParityRange;
-	rf_mutex_init(&raidPtr->parityBufferPool.mutex);
-	raidPtr->parityBufferPool.cond = 0;
+	rf_init_mutex2(raidPtr->parityBufferPool.mutex, IPL_VM);
+	rf_init_cond2(raidPtr->parityBufferPool.cond, "rfpbpl");
 	raidPtr->parityBufferPool.bufferSize = parityBufferCapacity *
 		raidPtr->bytesPerSector;
 	printf("parityBufferPool.bufferSize %d\n",
@@ -392,7 +392,7 @@
 			  raidPtr);
 	/* initialize parityLogDiskQueue */
 	rf_init_mutex2(raidPtr->parityLogDiskQueue.mutex, IPL_VM);
-	rf_init_cond2(raidPtr->parityLogDiskQueue.cond, "rfdskq");
+	rf_init_cond2(raidPtr->parityLogDiskQueue.cond, "rfpldq");
 	raidPtr->parityLogDiskQueue.flushQueue = NULL;
 	raidPtr->parityLogDiskQueue.reintQueue = NULL;
 	raidPtr->parityLogDiskQueue.bufHead = NULL;
@@ -538,7 +538,6 @@
 {
 	int     i;
 
-	RF_LOCK_MUTEX(queue->mutex);
 	if (queue->availableBuffers != queue->totalBuffers) {
 		printf("Attempt to free region queue which is still in use!\n");
 		RF_ASSERT(0);
@@ -546,7 +545,8 @@
 	for (i = 0; i < queue->totalBuffers; i++)
 		RF_Free(queue->buffers[i], queue->bufferSize);
 	RF_Free(queue->buffers, queue->totalBuffers * sizeof(void *));
-	RF_UNLOCK_MUTEX(queue->mutex);
+	rf_destroy_mutex2(queue->mutex);
+	rf_destroy_cond2(queue->cond);
 }
 
 static void

Reply via email to