Module Name:    src
Committed By:   mrg
Date:           Sun May  1 10:01:01 UTC 2011

Modified Files:
        src/sys/dev/raidframe: rf_reconstruct.h rf_reconutil.c rf_revent.c
            rf_threadstuff.h

Log Message:
convert eq_mutex to a kmutex.
convert ltsleep() used for plain timeout into kpause().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/raidframe/rf_reconstruct.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/raidframe/rf_reconutil.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_revent.c
cvs rdiff -u -r1.26 -r1.27 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_reconstruct.h
diff -u src/sys/dev/raidframe/rf_reconstruct.h:1.24 src/sys/dev/raidframe/rf_reconstruct.h:1.25
--- src/sys/dev/raidframe/rf_reconstruct.h:1.24	Mon May 19 19:49:55 2008
+++ src/sys/dev/raidframe/rf_reconstruct.h	Sun May  1 10:01:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconstruct.h,v 1.24 2008/05/19 19:49:55 oster Exp $	*/
+/*	$NetBSD: rf_reconstruct.h,v 1.25 2011/05/01 10:01:01 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -137,7 +137,7 @@
 	/* reconstruction event queue */
 	RF_ReconEvent_t *eventQueue;	/* queue of pending reconstruction
 					 * events */
-        RF_DECLARE_MUTEX(eq_mutex)	/* mutex for locking event
+	rf_declare_mutex2(eq_mutex);	/* mutex for locking event
 					 * queue */
 	int     eq_count;	/* debug only */
 

Index: src/sys/dev/raidframe/rf_reconutil.c
diff -u src/sys/dev/raidframe/rf_reconutil.c:1.29 src/sys/dev/raidframe/rf_reconutil.c:1.30
--- src/sys/dev/raidframe/rf_reconutil.c:1.29	Sat Apr 30 01:44:36 2011
+++ src/sys/dev/raidframe/rf_reconutil.c	Sun May  1 10:01:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconutil.c,v 1.29 2011/04/30 01:44:36 mrg Exp $	*/
+/*	$NetBSD: rf_reconutil.c,v 1.30 2011/05/01 10:01:01 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.29 2011/04/30 01:44:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.30 2011/05/01 10:01:01 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -125,7 +125,7 @@
 	}
 
 	/* initialize the event queue */
-	rf_mutex_init(&reconCtrlPtr->eq_mutex);
+	rf_init_mutex2(reconCtrlPtr->eq_mutex, IPL_VM);
 
 	reconCtrlPtr->eventQueue = NULL;
 	reconCtrlPtr->eq_count = 0;
@@ -171,6 +171,8 @@
 		t = reconCtrlPtr->floatingRbufs;
 	}
 
+	rf_destroy_mutex2(reconCtrlPtr->eq_mutex);
+
 	rf_FreeReconMap(reconCtrlPtr->reconMap);
 	rf_FreeParityStripeStatusTable(raidPtr, reconCtrlPtr->pssTable);
 	RF_Free(reconCtrlPtr->perDiskInfo,

Index: src/sys/dev/raidframe/rf_revent.c
diff -u src/sys/dev/raidframe/rf_revent.c:1.25 src/sys/dev/raidframe/rf_revent.c:1.26
--- src/sys/dev/raidframe/rf_revent.c:1.25	Mon May 19 19:49:55 2008
+++ src/sys/dev/raidframe/rf_revent.c	Sun May  1 10:01:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_revent.c,v 1.25 2008/05/19 19:49:55 oster Exp $	*/
+/*	$NetBSD: rf_revent.c,v 1.26 2011/05/01 10:01:01 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_revent.c,v 1.25 2008/05/19 19:49:55 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_revent.c,v 1.26 2011/05/01 10:01:01 mrg Exp $");
 
 #include <sys/errno.h>
 
@@ -81,7 +81,7 @@
 	RF_ReconEvent_t *event;
 	int stall_count;
 
-	RF_LOCK_MUTEX(rctrl->eq_mutex);
+	rf_lock_mutex2(rctrl->eq_mutex);
 	/* q null and count==0 must be equivalent conditions */
 	RF_ASSERT((rctrl->eventQueue == NULL) == (rctrl->eq_count == 0));
 
@@ -114,9 +114,8 @@
 			reconDesc->numReconExecDelays++;
 #endif				/* RF_RECON_STATS > 0 */
 
-			status = ltsleep(&reconDesc->reconExecTicks, PRIBIO,
-					 "recon delay", RECON_TIMO,
-					 &rctrl->eq_mutex);
+			status = rf_sleep("rfrecond", RECON_TIMO,
+					  rctrl->eq_mutex);
 			RF_ASSERT(status == EWOULDBLOCK);
 			reconDesc->reconExecTicks = 0;
 		}
@@ -128,8 +127,7 @@
 		reconDesc->numReconEventWaits++;
 #endif				/* RF_RECON_STATS > 0 */
 
-		ltsleep(&(rctrl)->eventQueue, PRIBIO,  "raidframe eventq",
-			RF_EVENTQ_WAIT, &((rctrl)->eq_mutex));
+		rf_sleep("rfevq", RF_EVENTQ_WAIT, rctrl->eq_mutex);
 
 		stall_count++;
 
@@ -155,7 +153,7 @@
 
 	/* q null and count==0 must be equivalent conditions */
 	RF_ASSERT((rctrl->eventQueue == NULL) == (rctrl->eq_count == 0));
-	RF_UNLOCK_MUTEX(rctrl->eq_mutex);
+	rf_unlock_mutex2(rctrl->eq_mutex);
 	return (event);
 }
 /* enqueues a reconstruction event on the indicated queue */
@@ -170,13 +168,13 @@
 		RF_ASSERT(col != rctrl->fcol);
 	}
 	RF_ASSERT(col >= 0 && col <= raidPtr->numCol);
-	RF_LOCK_MUTEX(rctrl->eq_mutex);
+	rf_lock_mutex2(rctrl->eq_mutex);
 	/* q null and count==0 must be equivalent conditions */
 	RF_ASSERT((rctrl->eventQueue == NULL) == (rctrl->eq_count == 0));
 	event->next = rctrl->eventQueue;
 	rctrl->eventQueue = event;
 	rctrl->eq_count++;
-	RF_UNLOCK_MUTEX(rctrl->eq_mutex);
+	rf_unlock_mutex2(rctrl->eq_mutex);
 
 	wakeup(&(rctrl)->eventQueue);
 }
@@ -206,7 +204,7 @@
 	RF_ReconCtrl_t *rctrl = reconDesc->raidPtr->reconControl;
 	RF_ReconEvent_t *event;
 
-	RF_LOCK_MUTEX(rctrl->eq_mutex);
+	rf_lock_mutex2(rctrl->eq_mutex);
 	while (rctrl->eventQueue!=NULL) {
 
 		event = rctrl->eventQueue;
@@ -216,7 +214,7 @@
 		/* dump it */
 		rf_FreeReconEventDesc(event);
 	}
-	RF_UNLOCK_MUTEX(rctrl->eq_mutex);
+	rf_unlock_mutex2(rctrl->eq_mutex);
 }
 
 void

Index: src/sys/dev/raidframe/rf_threadstuff.h
diff -u src/sys/dev/raidframe/rf_threadstuff.h:1.26 src/sys/dev/raidframe/rf_threadstuff.h:1.27
--- src/sys/dev/raidframe/rf_threadstuff.h:1.26	Sat Apr 30 01:44:36 2011
+++ src/sys/dev/raidframe/rf_threadstuff.h	Sun May  1 10:01:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_threadstuff.h,v 1.26 2011/04/30 01:44:36 mrg Exp $	*/
+/*	$NetBSD: rf_threadstuff.h,v 1.27 2011/05/01 10:01:01 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -91,6 +91,8 @@
 #define rf_signal_cond2(_c_)       cv_signal(&(_c_))
 #define rf_broadcast_cond2(_c_)    cv_broadcast(&(_c_))
 
+#define rf_sleep(_w_,_t_,_m_)      kpause((_w_), false, (_t_), &(_m_))
+
 /*
  * In NetBSD, kernel threads are simply processes which share several
  * substructures and never run in userspace.

Reply via email to