Module Name:    src
Committed By:   mrg
Date:           Wed May 11 18:13:12 UTC 2011

Modified Files:
        src/sys/dev/raidframe: rf_copyback.c rf_dagutils.c rf_disks.c
            rf_driver.c rf_engine.c rf_map.c rf_netbsdkintf.c rf_paritylog.h
            rf_raid.h rf_reconstruct.c rf_reconutil.c rf_states.c
            rf_threadstuff.h

Log Message:
convert the main raidPtr mutex to a kmutex, and add a couple of cv's to
cover the old sleep/wakeup points for adding_hot_spare and waitForReconCond.
convert all remaining simple_lock's to kmutexes (they're not used or compiled
right now... even with all options enabled) and remove the support for them.

this leaves just a pair of tsleep()/wakeup() calls using old scheduling APIs.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/raidframe/rf_copyback.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/raidframe/rf_dagutils.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/raidframe/rf_engine.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/raidframe/rf_map.c
cvs rdiff -u -r1.290 -r1.291 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/raidframe/rf_paritylog.h
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/raidframe/rf_raid.h
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/raidframe/rf_reconstruct.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/raidframe/rf_reconutil.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/raidframe/rf_states.c
cvs rdiff -u -r1.32 -r1.33 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_copyback.c
diff -u src/sys/dev/raidframe/rf_copyback.c:1.46 src/sys/dev/raidframe/rf_copyback.c:1.47
--- src/sys/dev/raidframe/rf_copyback.c:1.46	Sun May  1 01:09:05 2011
+++ src/sys/dev/raidframe/rf_copyback.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_copyback.c,v 1.46 2011/05/01 01:09:05 mrg Exp $	*/
+/*	$NetBSD: rf_copyback.c,v 1.47 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -38,7 +38,7 @@
  ****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.46 2011/05/01 01:09:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.47 2011/05/11 18:13:12 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -205,11 +205,11 @@
 	rf_SuspendNewRequestsAndWait(raidPtr);
 
 	/* adjust state of the array and of the disks */
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->Disks[desc->fcol].status = rf_ds_optimal;
 	raidPtr->status = rf_rs_optimal;
 	rf_copyback_in_progress = 1;	/* debug only */
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	RF_GETTIME(desc->starttime);
 	rf_ContinueCopyback(desc);
@@ -404,14 +404,14 @@
 	struct timeval t, diff;
 
 	if (!status) {
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
 			RF_ASSERT(raidPtr->Layout.map->parityConfig == 'D');
 			rf_FreeSpareTable(raidPtr);
 		} else {
 			raidPtr->Disks[desc->spCol].status = rf_ds_spare;
 		}
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		RF_GETTIME(t);
 		RF_TIMEVAL_DIFF(&desc->starttime, &t, &diff);

Index: src/sys/dev/raidframe/rf_dagutils.c
diff -u src/sys/dev/raidframe/rf_dagutils.c:1.52 src/sys/dev/raidframe/rf_dagutils.c:1.53
--- src/sys/dev/raidframe/rf_dagutils.c:1.52	Sun Mar 15 17:17:23 2009
+++ src/sys/dev/raidframe/rf_dagutils.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_dagutils.c,v 1.52 2009/03/15 17:17:23 cegger Exp $	*/
+/*	$NetBSD: rf_dagutils.c,v 1.53 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.52 2009/03/15 17:17:23 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.53 2011/05/11 18:13:12 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -359,7 +359,7 @@
 					raidPtr->logBytesPerSector),
 		     M_RAIDFRAME, M_NOWAIT);
 	if (!p) {
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		if (raidPtr->stripebuf_count > 0) {
 			vple = raidPtr->stripebuf;
 			raidPtr->stripebuf = vple->next;
@@ -371,7 +371,7 @@
 			printf("raid%d: Help!  Out of emergency full-stripe buffers!\n", raidPtr->raidid);
 #endif
 		}
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 		if (!p) {
 			/* We didn't get a buffer... not much we can do other than wait,
 			   and hope that someone frees up memory for us.. */
@@ -393,7 +393,7 @@
 void
 rf_FreeStripeBuffer(RF_Raid_t *raidPtr, RF_VoidPointerListElem_t *vple)
 {
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	if (raidPtr->stripebuf_count < raidPtr->numEmergencyStripeBuffers) {
 		/* just tack it in */
 		vple->next = raidPtr->stripebuf;
@@ -403,7 +403,7 @@
 		free(vple->p, M_RAIDFRAME);
 		rf_FreeVPListElem(vple);
 	}
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 }
 
 /* allocates a buffer big enough to hold the data described by the
@@ -438,7 +438,7 @@
 				 raidPtr->logBytesPerSector,
 				 M_RAIDFRAME, M_NOWAIT);
 	if (!p) {
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		if (raidPtr->iobuf_count > 0) {
 			vple = raidPtr->iobuf;
 			raidPtr->iobuf = vple->next;
@@ -450,7 +450,7 @@
 			printf("raid%d: Help!  Out of emergency buffers!\n", raidPtr->raidid);
 #endif
 		}
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 		if (!p) {
 			/* We didn't get a buffer... not much we can do other than wait,
 			   and hope that someone frees up memory for us.. */
@@ -466,7 +466,7 @@
 void
 rf_FreeIOBuffer(RF_Raid_t *raidPtr, RF_VoidPointerListElem_t *vple)
 {
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	if (raidPtr->iobuf_count < raidPtr->numEmergencyBuffers) {
 		/* just tack it in */
 		vple->next = raidPtr->iobuf;
@@ -476,7 +476,7 @@
 		free(vple->p, M_RAIDFRAME);
 		rf_FreeVPListElem(vple);
 	}
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 }
 
 

Index: src/sys/dev/raidframe/rf_disks.c
diff -u src/sys/dev/raidframe/rf_disks.c:1.78 src/sys/dev/raidframe/rf_disks.c:1.79
--- src/sys/dev/raidframe/rf_disks.c:1.78	Sat Feb 19 07:11:09 2011
+++ src/sys/dev/raidframe/rf_disks.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_disks.c,v 1.78 2011/02/19 07:11:09 enami Exp $	*/
+/*	$NetBSD: rf_disks.c,v 1.79 2011/05/11 18:13:12 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -60,7 +60,7 @@
  ***************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.78 2011/02/19 07:11:09 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.79 2011/05/11 18:13:12 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -972,13 +972,12 @@
 		return(EINVAL);
 	}
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
-	while (raidPtr->adding_hot_spare==1) {
-		ltsleep(&(raidPtr->adding_hot_spare), PRIBIO, "raidhs", 0,
-			&(raidPtr->mutex));
+	rf_lock_mutex2(raidPtr->mutex);
+	while (raidPtr->adding_hot_spare == 1) {
+		rf_wait_cond2(raidPtr->adding_hot_spare_cv, raidPtr->mutex);
 	}
-	raidPtr->adding_hot_spare=1;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	raidPtr->adding_hot_spare = 1;
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	/* the beginning of the spares... */
 	disks = &raidPtr->Disks[raidPtr->numCol];
@@ -1048,15 +1047,15 @@
 				 &raidPtr->shutdownList,
 				 raidPtr->cleanupList);
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->numSpare++;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 fail:
-	RF_LOCK_MUTEX(raidPtr->mutex);
-	raidPtr->adding_hot_spare=0;
-	wakeup(&(raidPtr->adding_hot_spare));
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
+	raidPtr->adding_hot_spare = 0;
+	rf_signal_cond2(raidPtr->adding_hot_spare_cv);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	return(ret);
 }

Index: src/sys/dev/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.127 src/sys/dev/raidframe/rf_driver.c:1.128
--- src/sys/dev/raidframe/rf_driver.c:1.127	Thu May  5 07:12:58 2011
+++ src/sys/dev/raidframe/rf_driver.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.127 2011/05/05 07:12:58 mrg Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.128 2011/05/11 18:13:12 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.127 2011/05/05 07:12:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.128 2011/05/11 18:13:12 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -233,12 +233,13 @@
 	}
 
 	/* Wait for any reconstruction to stop... */
+	rf_lock_mutex2(raidPtr->mutex);
 	while (raidPtr->reconInProgress) {
 		printf("raid%d: Waiting for reconstruction to stop...\n",
 		       raidPtr->raidid);
-		tsleep(&raidPtr->waitForReconCond, PRIBIO,
-		       "rfreshutdown",0);
+		rf_wait_cond2(raidPtr->waitForReconCond, raidPtr->mutex);
 	}
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	raidPtr->valid = 0;
 
@@ -253,12 +254,17 @@
 
 	rf_ShutdownList(&raidPtr->shutdownList);
 
+	rf_destroy_cond2(raidPtr->waitForReconCond);
+	rf_destroy_cond2(raidPtr->adding_hot_spare_cv);
+
 	rf_destroy_mutex2(raidPtr->access_suspend_mutex);
 	rf_destroy_cond2(raidPtr->access_suspend_cv);
 
 	rf_destroy_cond2(raidPtr->outstandingCond);
 	rf_destroy_mutex2(raidPtr->rad_lock);
 
+	rf_destroy_mutex2(raidPtr->mutex);
+
 	rf_UnconfigureArray();
 
 	return (0);
@@ -333,7 +339,7 @@
 	}
 	rf_unlock_mutex2(configureMutex);
 
-	rf_mutex_init(&raidPtr->mutex);
+	rf_init_mutex2(raidPtr->mutex, IPL_VM);
 	/* set up the cleanup list.  Do this after ConfigureDebug so that
 	 * value of memDebug will be set */
 
@@ -364,7 +370,7 @@
 	rf_init_mutex2(raidPtr->access_suspend_mutex, IPL_VM);
 	rf_init_cond2(raidPtr->access_suspend_cv, "rfquiesce");
 
-	raidPtr->waitForReconCond = 0;
+	rf_init_cond2(raidPtr->waitForReconCond, "rfrcnw");
 
 	if (ac!=NULL) {
 		/* We have an AutoConfig structure..  Don't do the
@@ -397,6 +403,9 @@
 	raidPtr->parity_rewrite_in_progress = 0;
 	raidPtr->adding_hot_spare = 0;
 	raidPtr->recon_in_progress = 0;
+
+	rf_init_cond2(raidPtr->adding_hot_spare_cv, "raidhs");
+
 	raidPtr->maxOutstanding = cfgPtr->maxOutstandingDiskReqs;
 
 	/* autoconfigure and root_partition will actually get filled in
@@ -703,7 +712,7 @@
 		printf("Can't set reconfigured mode in dedicated-spare array\n");
 		RF_PANIC();
 	}
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->numFailures++;
 	raidPtr->Disks[col].status = rf_ds_dist_spared;
 	raidPtr->status = rf_rs_reconfigured;
@@ -712,7 +721,7 @@
 	 * architecture. */
 	if (raidPtr->Layout.map->flags & RF_BD_DECLUSTERED)
 		rf_InstallSpareTable(raidPtr, col);
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 	return (0);
 }
 #endif
@@ -727,7 +736,7 @@
 
 	rf_SuspendNewRequestsAndWait(raidPtr);
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	if (raidPtr->Disks[fcol].status != rf_ds_failed) {
 		/* must be failing something that is valid, or else it's
 		   already marked as failed (in which case we don't
@@ -736,7 +745,7 @@
 		raidPtr->Disks[fcol].status = rf_ds_failed;
 		raidPtr->status = rf_rs_degraded;
 	}
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE);
 
@@ -746,14 +755,14 @@
 	rf_close_component(raidPtr, raidPtr->raid_cinfo[fcol].ci_vp,
 			   raidPtr->Disks[fcol].auto_configured);
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->raid_cinfo[fcol].ci_vp = NULL;
 
 	/* Need to mark the component as not being auto_configured
 	   (in case it was previously). */
 
 	raidPtr->Disks[fcol].auto_configured = 0;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 	/* now we can allow IO to continue -- we'll be suspending it
 	   again in rf_ReconstructFailedDisk() if we have to.. */
 

Index: src/sys/dev/raidframe/rf_engine.c
diff -u src/sys/dev/raidframe/rf_engine.c:1.45 src/sys/dev/raidframe/rf_engine.c:1.46
--- src/sys/dev/raidframe/rf_engine.c:1.45	Mon May  2 01:14:06 2011
+++ src/sys/dev/raidframe/rf_engine.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_engine.c,v 1.45 2011/05/02 01:14:06 mrg Exp $	*/
+/*	$NetBSD: rf_engine.c,v 1.46 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -55,7 +55,7 @@
  ****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.45 2011/05/02 01:14:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.46 2011/05/11 18:13:12 mrg Exp $");
 
 #include <sys/errno.h>
 
@@ -86,7 +86,7 @@
 	rf_wait_cond2((_r_)->node_queue_cv, (_r_)->node_queue_mutex)
 
 #define	DO_SIGNAL(_r_) \
-	rf_broadcast_cond2((_r_)->node_queue_cv)	/* XXX RF_SIGNAL_COND? */
+	rf_broadcast_cond2((_r_)->node_queue_cv)	/* XXX rf_signal_cond2? */
 
 static void
 rf_ShutdownEngine(void *arg)

Index: src/sys/dev/raidframe/rf_map.c
diff -u src/sys/dev/raidframe/rf_map.c:1.44 src/sys/dev/raidframe/rf_map.c:1.45
--- src/sys/dev/raidframe/rf_map.c:1.44	Sun Mar 15 17:17:23 2009
+++ src/sys/dev/raidframe/rf_map.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_map.c,v 1.44 2009/03/15 17:17:23 cegger Exp $	*/
+/*	$NetBSD: rf_map.c,v 1.45 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  **************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.44 2009/03/15 17:17:23 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.45 2011/05/11 18:13:12 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -632,9 +632,9 @@
 	RF_SectorNum_t diskOffset, poffset;
 
 	/* quick out in the fault-free case.  */
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	numFailures = raidPtr->numFailures;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 	if (numFailures == 0)
 		return (0);
 
@@ -683,9 +683,9 @@
 	int     numFailures;
 
 	/* quick out in the fault-free case.  */
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	numFailures = raidPtr->numFailures;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 	if (numFailures == 0)
 		return (0);
 	numFailures = 0;

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.290 src/sys/dev/raidframe/rf_netbsdkintf.c:1.291
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.290	Tue May 10 05:08:51 2011
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.290 2011/05/10 05:08:51 mrg Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.291 2011/05/11 18:13:12 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.290 2011/05/10 05:08:51 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.291 2011/05/11 18:13:12 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1392,7 +1392,7 @@
 			return(EINVAL);
 		}
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		if ((raidPtr->Disks[column].status == rf_ds_optimal) &&
 		    (raidPtr->numFailures > 0)) {
 			/* XXX 0 above shouldn't be constant!!! */
@@ -1403,7 +1403,7 @@
 			       raidPtr->raidid);
 			printf("raid%d:     Col: %d   Too many failures.\n",
 			       raidPtr->raidid, column);
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
 		if (raidPtr->Disks[column].status ==
@@ -1412,14 +1412,14 @@
 			       raidPtr->raidid);
 			printf("raid%d:    Col: %d   Reconstruction already occuring!\n", raidPtr->raidid, column);
 
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
 		if (raidPtr->Disks[column].status == rf_ds_spared) {
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		RF_Malloc(rrcopy, sizeof(*rrcopy), (struct rf_recon_req *));
 		if (rrcopy == NULL)
@@ -1532,26 +1532,26 @@
 			return (EINVAL);
 
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		if (raidPtr->status == rf_rs_reconstructing) {
 			/* you can't fail a disk while we're reconstructing! */
 			/* XXX wrong for RAID6 */
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
 		if ((raidPtr->Disks[rr->col].status ==
 		     rf_ds_optimal) && (raidPtr->numFailures > 0)) {
 			/* some other component has failed.  Let's not make
 			   things worse. XXX wrong for RAID6 */
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
 		if (raidPtr->Disks[rr->col].status == rf_ds_spared) {
 			/* Can't fail a spared disk! */
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		/* make a copy of the recon request so that we don't rely on
 		 * the user's buffer */
@@ -1974,18 +1974,18 @@
 	rs = &raid_softc[unit];
 
 	/* quick check to see if anything has died recently */
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	if (raidPtr->numNewFailures > 0) {
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 		rf_update_component_labels(raidPtr,
 					   RF_NORMAL_COMPONENT_UPDATE);
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->numNewFailures--;
 	}
 
 	/* Check to see if we're at the limit... */
 	while (raidPtr->openings > 0) {
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		/* get the next item, if any, from the queue */
 		if ((bp = bufq_get(rs->buf_queue)) == NULL) {
@@ -2026,7 +2026,7 @@
 			bp->b_error = ENOSPC;
 			bp->b_resid = bp->b_bcount;
 			biodone(bp);
-			RF_LOCK_MUTEX(raidPtr->mutex);
+			rf_lock_mutex2(raidPtr->mutex);
 			continue;
 		}
 		/*
@@ -2037,16 +2037,16 @@
 			bp->b_error = EINVAL;
 			bp->b_resid = bp->b_bcount;
 			biodone(bp);
-			RF_LOCK_MUTEX(raidPtr->mutex);
+			rf_lock_mutex2(raidPtr->mutex);
 			continue;
 
 		}
 		db1_printf(("Calling DoAccess..\n"));
 
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->openings--;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		/*
 		 * Everything is async.
@@ -2073,9 +2073,9 @@
 			/* continue loop */
 		}
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 	}
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 }
 
 

Index: src/sys/dev/raidframe/rf_paritylog.h
diff -u src/sys/dev/raidframe/rf_paritylog.h:1.11 src/sys/dev/raidframe/rf_paritylog.h:1.12
--- src/sys/dev/raidframe/rf_paritylog.h:1.11	Wed May 11 06:20:33 2011
+++ src/sys/dev/raidframe/rf_paritylog.h	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylog.h,v 1.11 2011/05/11 06:20:33 mrg Exp $	*/
+/*	$NetBSD: rf_paritylog.h,v 1.12 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -71,7 +71,7 @@
 };
 
 struct RF_ParityLogAppendQueue_s {
-	RF_DECLARE_MUTEX(mutex)
+	rf_declare_mutex2(mutex);
 };
 
 struct RF_ParityLogRecord_s {

Index: src/sys/dev/raidframe/rf_raid.h
diff -u src/sys/dev/raidframe/rf_raid.h:1.42 src/sys/dev/raidframe/rf_raid.h:1.43
--- src/sys/dev/raidframe/rf_raid.h:1.42	Thu May  5 07:12:58 2011
+++ src/sys/dev/raidframe/rf_raid.h	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_raid.h,v 1.42 2011/05/05 07:12:58 mrg Exp $	*/
+/*	$NetBSD: rf_raid.h,v 1.43 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -84,7 +84,7 @@
 };
 
 struct RF_ThroughputStats_s {
-	RF_DECLARE_MUTEX(mutex)	/* a mutex used to lock the configuration
+	rf_declare_mutex2(mutex);/* a mutex used to lock the configuration
 				 * stuff */
 	struct timeval start;	/* timer started when numOutstandingRequests
 				 * moves from 0 to 1 */
@@ -124,7 +124,7 @@
 	 * local copy of this pointer for the actual accesses. */
 	/* The remainder of the structure can change, and therefore requires
 	 * locking on reads and updates */
-	RF_DECLARE_MUTEX(mutex)	/* mutex used to serialize access to
+	rf_declare_mutex2(mutex);/* mutex used to serialize access to
 				 * the fields below */
 	RF_RowStatus_t status;	/* the status of each row in the array */
 	int     valid;		/* indicates successful configuration */
@@ -187,7 +187,7 @@
 	RF_HeadSepLimit_t headSepLimit;
 	int     numFloatingReconBufs;
 	int     reconInProgress;
-	RF_DECLARE_COND(waitForReconCond)
+	rf_declare_cond2(waitForReconCond);	/* goes with raidPtr->mutex */
 	RF_RaidReconDesc_t *reconDesc;	/* reconstruction descriptor */
 	RF_ReconCtrl_t *reconControl;	/* reconstruction control structure
 					 * pointers for each row in the array */
@@ -214,6 +214,8 @@
 	int     copyback_in_progress;
 	int     adding_hot_spare;
 
+	rf_declare_cond2(adding_hot_spare_cv);
+
 	/*
          * Engine thread control
          */

Index: src/sys/dev/raidframe/rf_reconstruct.c
diff -u src/sys/dev/raidframe/rf_reconstruct.c:1.112 src/sys/dev/raidframe/rf_reconstruct.c:1.113
--- src/sys/dev/raidframe/rf_reconstruct.c:1.112	Mon May  2 07:29:18 2011
+++ src/sys/dev/raidframe/rf_reconstruct.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconstruct.c,v 1.112 2011/05/02 07:29:18 mrg Exp $	*/
+/*	$NetBSD: rf_reconstruct.c,v 1.113 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  ************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.112 2011/05/02 07:29:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.113 2011/05/11 18:13:12 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -213,22 +213,23 @@
 	         * The current infrastructure only supports reconstructing one
 	         * disk at a time for each array.
 	         */
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		while (raidPtr->reconInProgress) {
-			RF_WAIT_COND(raidPtr->waitForReconCond, raidPtr->mutex);
+			rf_wait_cond2(raidPtr->waitForReconCond, raidPtr->mutex);
 		}
 		raidPtr->reconInProgress++;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 		rc = rf_ReconstructFailedDiskBasic(raidPtr, col);
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->reconInProgress--;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
 	} else {
 		RF_ERRORMSG1("RECON: no way to reconstruct failed disk for arch %c\n",
 		    lp->parityConfig);
 		rc = EIO;
+		rf_lock_mutex2(raidPtr->mutex);
 	}
-	RF_SIGNAL_COND(raidPtr->waitForReconCond);
+	rf_signal_cond2(raidPtr->waitForReconCond);
+	rf_unlock_mutex2(raidPtr->mutex);
 	return (rc);
 }
 
@@ -245,13 +246,13 @@
 	/* spare disk descriptors are stored in row 0.  This may have to
 	 * change eventually */
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	RF_ASSERT(raidPtr->Disks[col].status == rf_ds_failed);
 #if RF_INCLUDE_PARITY_DECLUSTERING_DS > 0
 	if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
 		if (raidPtr->status != rf_rs_degraded) {
 			RF_ERRORMSG1("Unable to reconstruct disk at col %d because status not degraded\n", col);
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (EINVAL);
 		}
 		scol = (-1);
@@ -266,14 +267,14 @@
 		}
 		if (!spareDiskPtr) {
 			RF_ERRORMSG1("Unable to reconstruct disk at col %d because no spares are available\n", col);
-			RF_UNLOCK_MUTEX(raidPtr->mutex);
+			rf_unlock_mutex2(raidPtr->mutex);
 			return (ENOSPC);
 		}
 		printf("RECON: initiating reconstruction on col %d -> spare at col %d\n", col, scol);
 #if RF_INCLUDE_PARITY_DECLUSTERING_DS > 0
 	}
 #endif
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	reconDesc = AllocRaidReconDesc((void *) raidPtr, col, spareDiskPtr, numDisksDone, scol);
 	raidPtr->reconDesc = (void *) reconDesc;
@@ -306,9 +307,9 @@
 
 		/* XXX doesn't hold for RAID 6!!*/
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->parity_good = RF_RAID_CLEAN;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		/* XXXX MORE NEEDED HERE */
 
@@ -316,13 +317,13 @@
 	} else {
 		/* Reconstruct failed. */
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		/* Failed disk goes back to "failed" status */
 		raidPtr->Disks[col].status = rf_ds_failed;
 
 		/* Spare disk goes back to "spare" status. */
 		spareDiskPtr->status = rf_ds_spare;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 	}
 	rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE);
@@ -354,12 +355,14 @@
 	int retcode;
 	int ac;
 
+	rf_lock_mutex2(raidPtr->mutex);
 	lp = raidPtr->Layout.map;
 	if (!lp->SubmitReconBuffer) {
 		RF_ERRORMSG1("RECON: no way to reconstruct failed disk for arch %c\n",
 			     lp->parityConfig);
 		/* wakeup anyone who might be waiting to do a reconstruct */
-		RF_SIGNAL_COND(raidPtr->waitForReconCond);
+		rf_signal_cond2(raidPtr->waitForReconCond);
+		rf_unlock_mutex2(raidPtr->mutex);
 		return(EIO);
 	}
 
@@ -367,21 +370,20 @@
 	 * The current infrastructure only supports reconstructing one
 	 * disk at a time for each array.
 	 */
-	RF_LOCK_MUTEX(raidPtr->mutex);
 
 	if (raidPtr->Disks[col].status != rf_ds_failed) {
 		/* "It's gone..." */
 		raidPtr->numFailures++;
 		raidPtr->Disks[col].status = rf_ds_failed;
 		raidPtr->status = rf_rs_degraded;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 		rf_update_component_labels(raidPtr,
 					   RF_NORMAL_COMPONENT_UPDATE);
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 	}
 
 	while (raidPtr->reconInProgress) {
-		RF_WAIT_COND(raidPtr->waitForReconCond, raidPtr->mutex);
+		rf_wait_cond2(raidPtr->waitForReconCond, raidPtr->mutex);
 	}
 
 	raidPtr->reconInProgress++;
@@ -400,8 +402,8 @@
 		RF_ERRORMSG1("Unable to reconstruct to disk at col %d: operation not supported for RF_DISTRIBUTE_SPARE\n", col);
 
 		raidPtr->reconInProgress--;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
-		RF_SIGNAL_COND(raidPtr->waitForReconCond);
+		rf_signal_cond2(raidPtr->waitForReconCond);
+		rf_unlock_mutex2(raidPtr->mutex);
 		return (EINVAL);
 	}
 #endif
@@ -416,9 +418,9 @@
 #endif
 		vp = raidPtr->raid_cinfo[col].ci_vp;
 		ac = raidPtr->Disks[col].auto_configured;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 		rf_close_component(raidPtr, vp, ac);
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->raid_cinfo[col].ci_vp = NULL;
 	}
 	/* note that this disk was *not* auto_configured (any longer)*/
@@ -428,7 +430,7 @@
 	printf("About to (re-)open the device for rebuilding: %s\n",
 	       raidPtr->Disks[col].devname);
 #endif
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 	pb = pathbuf_create(raidPtr->Disks[col].devname);
 	if (pb == NULL) {
 		retcode = ENOMEM;
@@ -443,10 +445,10 @@
 
 		/* the component isn't responding properly...
 		   must be still dead :-( */
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->reconInProgress--;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
-		RF_SIGNAL_COND(raidPtr->waitForReconCond);
+		rf_signal_cond2(raidPtr->waitForReconCond);
+		rf_unlock_mutex2(raidPtr->mutex);
 		return(retcode);
 	}
 
@@ -454,22 +456,22 @@
 	   How about actually getting a vp for it? */
 
 	if ((retcode = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0) {
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->reconInProgress--;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
-		RF_SIGNAL_COND(raidPtr->waitForReconCond);
+		rf_signal_cond2(raidPtr->waitForReconCond);
+		rf_unlock_mutex2(raidPtr->mutex);
 		return(retcode);
 	}
 
 	retcode = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, curlwp->l_cred);
 	if (retcode) {
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->reconInProgress--;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
-		RF_SIGNAL_COND(raidPtr->waitForReconCond);
+		rf_signal_cond2(raidPtr->waitForReconCond);
+		rf_unlock_mutex2(raidPtr->mutex);
 		return(retcode);
 	}
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->Disks[col].blockSize =	dpart.disklab->d_secsize;
 
 	raidPtr->Disks[col].numBlocks = dpart.part->p_size -
@@ -485,7 +487,7 @@
 	   it speeds up * the parity scan */
 	raidPtr->Disks[col].numBlocks = raidPtr->Disks[col].numBlocks *
 		rf_sizePercentage / 100;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	spareDiskPtr = &raidPtr->Disks[col];
 	spareDiskPtr->status = rf_ds_used_spare;
@@ -507,19 +509,19 @@
 	rc = rf_ContinueReconstructFailedDisk(reconDesc);
 
 	if (!rc) {
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		/* Need to set these here, as at this point it'll be claiming
 		   that the disk is in rf_ds_spared!  But we know better :-) */
 
 		raidPtr->Disks[col].status = rf_ds_optimal;
 		raidPtr->status = rf_rs_optimal;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		/* fix up the component label */
 		/* Don't actually need the read here.. */
 		c_label = raidget_component_label(raidPtr, col);
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raid_init_component_label(raidPtr, c_label);
 
 		c_label->row = 0;
@@ -532,24 +534,24 @@
 		/* XXX doesn't hold for RAID 6!!*/
 
 		raidPtr->parity_good = RF_RAID_CLEAN;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		raidflush_component_label(raidPtr, col);
 	} else {
 		/* Reconstruct-in-place failed.  Disk goes back to
 		   "failed" status, regardless of what it was before.  */
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		raidPtr->Disks[col].status = rf_ds_failed;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 	}
 
 	rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE);
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->reconInProgress--;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_signal_cond2(raidPtr->waitForReconCond);
+	rf_unlock_mutex2(raidPtr->mutex);
 
-	RF_SIGNAL_COND(raidPtr->waitForReconCond);
 	return (rc);
 }
 
@@ -588,7 +590,7 @@
 	/* allocate our RF_ReconCTRL_t before we protect raidPtr->reconControl[row] */
 	tmp_reconctrl = rf_MakeReconControl(reconDesc, col, scol);
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 
 	/* create the reconstruction control pointer and install it in
 	 * the right slot */
@@ -600,7 +602,7 @@
 	raidPtr->Disks[col].status = rf_ds_reconstructing;
 	raidPtr->Disks[col].spareCol = scol;
 
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 
 	RF_GETTIME(raidPtr->reconControl->starttime);
 
@@ -781,7 +783,7 @@
 		/* we start by blocking IO to the RAID set. */
 		rf_SuspendNewRequestsAndWait(raidPtr);
 
-		RF_LOCK_MUTEX(raidPtr->mutex);
+		rf_lock_mutex2(raidPtr->mutex);
 		/* mark set as being degraded, rather than
 		   rf_rs_reconstructing as we were before the problem.
 		   After this is done we can update status of the
@@ -789,7 +791,7 @@
 		   trying to read from a failed component.
 		*/
 		raidPtr->status = rf_rs_degraded;
-		RF_UNLOCK_MUTEX(raidPtr->mutex);
+		rf_unlock_mutex2(raidPtr->mutex);
 
 		/* resume IO */
 		rf_ResumeNewRequests(raidPtr);
@@ -864,12 +866,12 @@
 
 	rf_SuspendNewRequestsAndWait(raidPtr);
 
-	RF_LOCK_MUTEX(raidPtr->mutex);
+	rf_lock_mutex2(raidPtr->mutex);
 	raidPtr->numFailures--;
 	ds = (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE);
 	raidPtr->Disks[col].status = (ds) ? rf_ds_dist_spared : rf_ds_spared;
 	raidPtr->status = (ds) ? rf_rs_reconfigured : rf_rs_optimal;
-	RF_UNLOCK_MUTEX(raidPtr->mutex);
+	rf_unlock_mutex2(raidPtr->mutex);
 	RF_GETTIME(etime);
 	RF_TIMEVAL_DIFF(&(raidPtr->reconControl->starttime), &etime, &elpsd);
 

Index: src/sys/dev/raidframe/rf_reconutil.c
diff -u src/sys/dev/raidframe/rf_reconutil.c:1.33 src/sys/dev/raidframe/rf_reconutil.c:1.34
--- src/sys/dev/raidframe/rf_reconutil.c:1.33	Mon May  2 07:29:18 2011
+++ src/sys/dev/raidframe/rf_reconutil.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconutil.c,v 1.33 2011/05/02 07:29:18 mrg Exp $	*/
+/*	$NetBSD: rf_reconutil.c,v 1.34 2011/05/11 18:13:12 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.33 2011/05/02 07:29:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.34 2011/05/11 18:13:12 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -274,7 +274,7 @@
 	pssTable = raidPtr->reconControl->pssTable;
 
 	for (i = 0; i < raidPtr->pssTableSize; i++) {
-		RF_LOCK_MUTEX(pssTable[i].mutex);
+		rf_lock_mutex2(pssTable[i].mutex);
 		for (p = pssTable[i].chain; p; p = p->next) {
 			rbuf = (RF_ReconBuffer_t *) p->rbuf;
 			if (rbuf && rbuf->type == RF_RBUF_TYPE_FLOATING)
@@ -291,7 +291,7 @@
 					sum++;
 			}
 		}
-		RF_UNLOCK_MUTEX(pssTable[i].mutex);
+		rf_unlock_mutex2(pssTable[i].mutex);
 	}
 
 	for (rbuf = raidPtr->reconControl->floatingRbufs; rbuf;

Index: src/sys/dev/raidframe/rf_states.c
diff -u src/sys/dev/raidframe/rf_states.c:1.48 src/sys/dev/raidframe/rf_states.c:1.49
--- src/sys/dev/raidframe/rf_states.c:1.48	Tue May 10 07:04:17 2011
+++ src/sys/dev/raidframe/rf_states.c	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_states.c,v 1.48 2011/05/10 07:04:17 mrg Exp $	*/
+/*	$NetBSD: rf_states.c,v 1.49 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.48 2011/05/10 07:04:17 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.49 2011/05/11 18:13:12 mrg Exp $");
 
 #include <sys/errno.h>
 
@@ -231,9 +231,9 @@
 	 * Wakeup any requests waiting to go.
 	 */
 
-	RF_LOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
-	((RF_Raid_t *) desc->raidPtr)->openings++;
-	RF_UNLOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
+	rf_lock_mutex2(desc->raidPtr->mutex);
+	desc->raidPtr->openings++;
+	rf_unlock_mutex2(desc->raidPtr->mutex);
 
 	rf_lock_mutex2(desc->raidPtr->iodone_lock);
 	rf_signal_cond2(desc->raidPtr->iodone_cv);

Index: src/sys/dev/raidframe/rf_threadstuff.h
diff -u src/sys/dev/raidframe/rf_threadstuff.h:1.32 src/sys/dev/raidframe/rf_threadstuff.h:1.33
--- src/sys/dev/raidframe/rf_threadstuff.h:1.32	Wed May 11 05:14:07 2011
+++ src/sys/dev/raidframe/rf_threadstuff.h	Wed May 11 18:13:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_threadstuff.h,v 1.32 2011/05/11 05:14:07 mrg Exp $	*/
+/*	$NetBSD: rf_threadstuff.h,v 1.33 2011/05/11 18:13:12 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -54,26 +54,9 @@
 #include <dev/raidframe/raidframevar.h>
 
 
-/* Old school simple_lock */
 typedef struct lwp *RF_Thread_t;
 typedef void *RF_ThreadArg_t;
 
-#define RF_DECLARE_MUTEX(_m_)           struct simplelock _m_;
-
-#define RF_DECLARE_COND(_c_)            int _c_;
-
-#define RF_LOCK_MUTEX(_m_)              simple_lock(&(_m_))
-#define RF_UNLOCK_MUTEX(_m_)            simple_unlock(&(_m_))
-
-#define RF_WAIT_COND(_c_,_m_)		\
-	ltsleep(&(_c_), PRIBIO, "rfwcond", 0, &(_m_))
-#define RF_SIGNAL_COND(_c_)            wakeup_one(&(_c_))
-
-#define rf_mutex_init(m)               simple_lock_init(m)
-
-
-/* Modern mutex */
-/* Note that rf_declare_{mutex,cond}2() do _NOT_ append the ; */
 #define rf_declare_mutex2(_m_)           kmutex_t _m_
 #define rf_declare_cond2(_c_)            kcondvar_t _c_
 

Reply via email to