Module Name:    src
Committed By:   mrg
Date:           Sat Apr 30 01:44:37 UTC 2011

Modified Files:
        src/sys/dev/raidframe: rf_driver.c rf_driver.h rf_mcpair.c rf_raid.h
            rf_reconutil.c rf_stripelocks.c rf_threadstuff.h

Log Message:
- convert rf_printf_mutex to a kmutex
- convert rf_rad_lock and the per-raid "cv" to per-raid kmutex/and real cv
- use rf_mutex_init() in places, and move it with the similar definitions


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/raidframe/rf_driver.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_mcpair.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/raidframe/rf_raid.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_reconutil.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_stripelocks.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_threadstuff.h

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_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.125 src/sys/dev/raidframe/rf_driver.c:1.126
--- src/sys/dev/raidframe/rf_driver.c:1.125	Wed Apr 27 07:55:14 2011
+++ src/sys/dev/raidframe/rf_driver.c	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.125 2011/04/27 07:55:14 mrg Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.126 2011/04/30 01:44:36 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.125 2011/04/27 07:55:14 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.126 2011/04/30 01:44:36 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -118,7 +118,6 @@
 #endif
 
 /* rad == RF_RaidAccessDesc_t */
-RF_DECLARE_MUTEX(rf_rad_lock)
 #define RF_MAX_FREE_RAD 128
 #define RF_MIN_FREE_RAD  32
 
@@ -134,7 +133,7 @@
 static void rf_ShutdownRDFreeList(void *);
 static int rf_ConfigureRDFreeList(RF_ShutdownList_t **);
 
-RF_DECLARE_MUTEX(rf_printf_mutex)	/* debug only:  avoids interleaved
+rf_declare_mutex2(rf_printf_mutex);	/* debug only:  avoids interleaved
 					 * printfs by different stripes */
 
 #define SIGNAL_QUIESCENT_COND(_raid_)  wakeup(&((_raid_)->accesses_suspended))
@@ -213,16 +212,16 @@
          * cuts down on the amount of serialization we've got going
          * on.
          */
-	RF_LOCK_MUTEX(rf_rad_lock);
+	rf_lock_mutex2(raidPtr->rad_lock);
 	if (raidPtr->waitShutdown) {
-		RF_UNLOCK_MUTEX(rf_rad_lock);
+		rf_unlock_mutex2(raidPtr->rad_lock);
 		return (EBUSY);
 	}
 	raidPtr->waitShutdown = 1;
 	while (raidPtr->nAccOutstanding) {
-		RF_WAIT_COND(raidPtr->outstandingCond, rf_rad_lock);
+		rf_wait_cond2(raidPtr->outstandingCond, raidPtr->rad_lock);
 	}
-	RF_UNLOCK_MUTEX(rf_rad_lock);
+	rf_unlock_mutex2(raidPtr->rad_lock);
 
 	/* Wait for any parity re-writes to stop... */
 	while (raidPtr->parity_rewrite_in_progress) {
@@ -253,6 +252,9 @@
 
 	rf_ShutdownList(&raidPtr->shutdownList);
 
+	rf_destroy_cond2(raidPtr->outstandingCond);
+	rf_destroy_mutex2(raidPtr->rad_lock);
+
 	rf_UnconfigureArray();
 
 	return (0);
@@ -299,7 +301,7 @@
 	rf_lock_mutex2(configureMutex);
 	configureCount++;
 	if (isconfigged == 0) {
-		rf_mutex_init(&rf_printf_mutex);
+		rf_init_mutex2(rf_printf_mutex, IPL_VM);
 
 		/* initialize globals */
 
@@ -353,7 +355,8 @@
 	DO_RAID_INIT_CONFIGURE(rf_ConfigureEngine);
 	DO_RAID_INIT_CONFIGURE(rf_ConfigureStripeLocks);
 
-	raidPtr->outstandingCond = 0;
+	rf_init_cond2(raidPtr->outstandingCond, "rfocond");
+	rf_init_mutex2(raidPtr->rad_lock, IPL_VM);
 
 	raidPtr->nAccOutstanding = 0;
 	raidPtr->waitShutdown = 0;
@@ -544,7 +547,6 @@
 	rf_pool_init(&rf_pools.rad, sizeof(RF_RaidAccessDesc_t),
 		     "rf_rad_pl", RF_MIN_FREE_RAD, RF_MAX_FREE_RAD);
 	rf_ShutdownCreate(listp, rf_ShutdownRDFreeList, NULL);
-	simple_lock_init(&rf_rad_lock);
 	return (0);
 }
 
@@ -558,20 +560,20 @@
 
 	desc = pool_get(&rf_pools.rad, PR_WAITOK);
 
-	RF_LOCK_MUTEX(rf_rad_lock);
+	rf_lock_mutex2(raidPtr->rad_lock);
 	if (raidPtr->waitShutdown) {
 		/*
 	         * Actually, we're shutting the array down. Free the desc
 	         * and return NULL.
 	         */
 
-		RF_UNLOCK_MUTEX(rf_rad_lock);
+		rf_unlock_mutex2(raidPtr->rad_lock);
 		pool_put(&rf_pools.rad, desc);
 		return (NULL);
 	}
 	raidPtr->nAccOutstanding++;
 
-	RF_UNLOCK_MUTEX(rf_rad_lock);
+	rf_unlock_mutex2(raidPtr->rad_lock);
 
 	desc->raidPtr = (void *) raidPtr;
 	desc->type = type;
@@ -628,12 +630,12 @@
 	}
 
 	pool_put(&rf_pools.rad, desc);
-	RF_LOCK_MUTEX(rf_rad_lock);
+	rf_lock_mutex2(raidPtr->rad_lock);
 	raidPtr->nAccOutstanding--;
 	if (raidPtr->waitShutdown) {
-		RF_SIGNAL_COND(raidPtr->outstandingCond);
+		rf_signal_cond2(raidPtr->outstandingCond);
 	}
-	RF_UNLOCK_MUTEX(rf_rad_lock);
+	rf_unlock_mutex2(raidPtr->rad_lock);
 }
 /*********************************************************************
  * Main routine for performing an access.

Index: src/sys/dev/raidframe/rf_driver.h
diff -u src/sys/dev/raidframe/rf_driver.h:1.18 src/sys/dev/raidframe/rf_driver.h:1.19
--- src/sys/dev/raidframe/rf_driver.h:1.18	Wed Apr 27 07:55:15 2011
+++ src/sys/dev/raidframe/rf_driver.h	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.h,v 1.18 2011/04/27 07:55:15 mrg Exp $	*/
+/*	$NetBSD: rf_driver.h,v 1.19 2011/04/30 01:44:36 mrg Exp $	*/
 /*
  * rf_driver.h
  */
@@ -41,7 +41,7 @@
 #define RF_RETRY_THRESHOLD 5
 #endif
 
-extern RF_DECLARE_MUTEX(rf_printf_mutex);
+extern rf_declare_mutex2(rf_printf_mutex);
 int rf_BootRaidframe(void);
 int rf_UnbootRaidframe(void);
 int rf_Shutdown(RF_Raid_t *);

Index: src/sys/dev/raidframe/rf_mcpair.c
diff -u src/sys/dev/raidframe/rf_mcpair.c:1.22 src/sys/dev/raidframe/rf_mcpair.c:1.23
--- src/sys/dev/raidframe/rf_mcpair.c:1.22	Sun Mar 15 17:17:23 2009
+++ src/sys/dev/raidframe/rf_mcpair.c	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_mcpair.c,v 1.22 2009/03/15 17:17:23 cegger Exp $	*/
+/*	$NetBSD: rf_mcpair.c,v 1.23 2011/04/30 01:44:36 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.22 2009/03/15 17:17:23 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.23 2011/04/30 01:44:36 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -75,7 +75,7 @@
 	RF_MCPair_t *t;
 
 	t = pool_get(&rf_pools.mcpair, PR_WAITOK);
-	simple_lock_init(&t->mutex);
+	rf_mutex_init(&t->mutex);
 	t->cond = 0;
 	t->flag = 0;
 

Index: src/sys/dev/raidframe/rf_raid.h
diff -u src/sys/dev/raidframe/rf_raid.h:1.40 src/sys/dev/raidframe/rf_raid.h:1.41
--- src/sys/dev/raidframe/rf_raid.h:1.40	Wed Apr 27 07:55:15 2011
+++ src/sys/dev/raidframe/rf_raid.h	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_raid.h,v 1.40 2011/04/27 07:55:15 mrg Exp $	*/
+/*	$NetBSD: rf_raid.h,v 1.41 2011/04/30 01:44:36 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -249,7 +249,8 @@
          * for a per-array piece of data, but otherwise, it'd be an extra
          * per-array lock, and that'd only be less efficient...)
          */
-	RF_DECLARE_COND(outstandingCond)
+	rf_declare_mutex2(rad_lock);
+	rf_declare_cond2(outstandingCond);
 	int     waitShutdown;
 	int     nAccOutstanding;
 

Index: src/sys/dev/raidframe/rf_reconutil.c
diff -u src/sys/dev/raidframe/rf_reconutil.c:1.28 src/sys/dev/raidframe/rf_reconutil.c:1.29
--- src/sys/dev/raidframe/rf_reconutil.c:1.28	Sun Mar  4 06:02:39 2007
+++ src/sys/dev/raidframe/rf_reconutil.c	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconutil.c,v 1.28 2007/03/04 06:02:39 christos Exp $	*/
+/*	$NetBSD: rf_reconutil.c,v 1.29 2011/04/30 01:44:36 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -31,7 +31,7 @@
  ********************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.28 2007/03/04 06:02:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.29 2011/04/30 01:44:36 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -125,13 +125,13 @@
 	}
 
 	/* initialize the event queue */
-	simple_lock_init(&reconCtrlPtr->eq_mutex);
+	rf_mutex_init(&reconCtrlPtr->eq_mutex);
 
 	reconCtrlPtr->eventQueue = NULL;
 	reconCtrlPtr->eq_count = 0;
 
 	/* make the floating recon buffers and append them to the free list */
-	simple_lock_init(&reconCtrlPtr->rb_mutex);
+	rf_mutex_init(&reconCtrlPtr->rb_mutex);
 
 	reconCtrlPtr->fullBufferList = NULL;
 	reconCtrlPtr->floatingRbufs = NULL;

Index: src/sys/dev/raidframe/rf_stripelocks.c
diff -u src/sys/dev/raidframe/rf_stripelocks.c:1.30 src/sys/dev/raidframe/rf_stripelocks.c:1.31
--- src/sys/dev/raidframe/rf_stripelocks.c:1.30	Sun Mar 15 17:17:23 2009
+++ src/sys/dev/raidframe/rf_stripelocks.c	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_stripelocks.c,v 1.30 2009/03/15 17:17:23 cegger Exp $	*/
+/*	$NetBSD: rf_stripelocks.c,v 1.31 2011/04/30 01:44:36 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.30 2009/03/15 17:17:23 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.31 2011/04/30 01:44:36 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -658,7 +658,7 @@
 	RF_StripeLockDesc_t *p;
 	RF_LockReqDesc_t *q;
 
-	RF_LOCK_MUTEX(rf_printf_mutex);
+	rf_lock_mutex2(rf_printf_mutex);
 	printf("Locked stripes:\n");
 	for (i = 0; i < rf_lockTableSize; i++)
 		if (lockTable[i].descList) {
@@ -714,6 +714,6 @@
 		printf("(none)\n");
 	else
 		printf("\n");
-	RF_UNLOCK_MUTEX(rf_printf_mutex);
+	rf_unlock_mutex2(rf_printf_mutex);
 }
 #endif

Index: src/sys/dev/raidframe/rf_threadstuff.h
diff -u src/sys/dev/raidframe/rf_threadstuff.h:1.25 src/sys/dev/raidframe/rf_threadstuff.h:1.26
--- src/sys/dev/raidframe/rf_threadstuff.h:1.25	Wed Apr 27 07:55:15 2011
+++ src/sys/dev/raidframe/rf_threadstuff.h	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_threadstuff.h,v 1.25 2011/04/27 07:55:15 mrg Exp $	*/
+/*	$NetBSD: rf_threadstuff.h,v 1.26 2011/04/30 01:44:36 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -70,6 +70,8 @@
 #define RF_SIGNAL_COND(_c_)            wakeup_one(&(_c_))
 #define RF_BROADCAST_COND(_c_)         wakeup(&(_c_))
 
+#define rf_mutex_init(m)               simple_lock_init(m)
+
 
 /* Modern mutex */
 /* Note that rf_declare_{mutex,cond}2() do _NOT_ append the ; */
@@ -102,6 +104,4 @@
 	kthread_create(PRI_NONE, 0, NULL, (void (*)(void *))(_func_), \
 	    (void *)(_arg_), &(_handle_), _fmt_, _fmt_arg_)
 
-#define rf_mutex_init(m) simple_lock_init(m)
-
 #endif				/* !_RF__RF_THREADSTUFF_H_ */

Reply via email to