Module Name:    src
Committed By:   mrg
Date:           Tue May 10 07:04:17 UTC 2011

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

Log Message:
convert RF_CommonLogData_s/RF_ReconMap_s mutex to a kmutex/cv.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/raidframe/rf_paritylog.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_paritylog.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_paritylogging.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_reconmap.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/raidframe/rf_reconmap.h
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/raidframe/rf_states.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.13 src/sys/dev/raidframe/rf_paritylog.c:1.14
--- src/sys/dev/raidframe/rf_paritylog.c:1.13	Sun Mar  4 06:02:38 2007
+++ src/sys/dev/raidframe/rf_paritylog.c	Tue May 10 07:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylog.c,v 1.13 2007/03/04 06:02:38 christos Exp $	*/
+/*	$NetBSD: rf_paritylog.c,v 1.14 2011/05/10 07:04:17 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.13 2007/03/04 06:02:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.14 2011/05/10 07:04:17 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -75,7 +75,8 @@
 	} else {
 		RF_UNLOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex);
 		RF_Malloc(common, sizeof(RF_CommonLogData_t), (RF_CommonLogData_t *));
-		rf_mutex_init(&common->mutex);
+		/* destroy is in rf_paritylogging.c */
+		rf_init_mutex2(common->mutex, IPL_VM);
 	}
 	common->next = NULL;
 	return (common);
@@ -815,13 +816,13 @@
 			/* Processed this item completely, decrement count of
 			 * items to be processed. */
 			RF_ASSERT(item->diskAddress.numSector == 0);
-			RF_LOCK_MUTEX(item->common->mutex);
+			rf_lock_mutex2(item->common->mutex);
 			item->common->cnt--;
 			if (item->common->cnt == 0)
 				itemDone = RF_TRUE;
 			else
 				itemDone = RF_FALSE;
-			RF_UNLOCK_MUTEX(item->common->mutex);
+			rf_unlock_mutex2(item->common->mutex);
 			if (itemDone) {
 				/* Finished processing all log data for this
 				 * IO Return structs to free list and invoke

Index: src/sys/dev/raidframe/rf_paritylog.h
diff -u src/sys/dev/raidframe/rf_paritylog.h:1.5 src/sys/dev/raidframe/rf_paritylog.h:1.6
--- src/sys/dev/raidframe/rf_paritylog.h:1.5	Sun Mar  4 06:02:38 2007
+++ src/sys/dev/raidframe/rf_paritylog.h	Tue May 10 07:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylog.h,v 1.5 2007/03/04 06:02:38 christos Exp $	*/
+/*	$NetBSD: rf_paritylog.h,v 1.6 2011/05/10 07:04:17 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -46,8 +46,8 @@
 }       RF_ParityRecordType_t;
 
 struct RF_CommonLogData_s {
-	RF_DECLARE_MUTEX(mutex)	/* protects cnt */
-	int     cnt;		/* when 0, time to call wakeFunc */
+	rf_declare_mutex2(mutex);	/* protects cnt */
+	int     cnt;			/* when 0, time to call wakeFunc */
 	RF_Raid_t *raidPtr;
 /*   int                    (*wakeFunc)(struct buf *); */
 	int     (*wakeFunc) (RF_DagNode_t * node, int status);

Index: src/sys/dev/raidframe/rf_paritylogging.c
diff -u src/sys/dev/raidframe/rf_paritylogging.c:1.28 src/sys/dev/raidframe/rf_paritylogging.c:1.29
--- src/sys/dev/raidframe/rf_paritylogging.c:1.28	Sun Mar  4 06:02:39 2007
+++ src/sys/dev/raidframe/rf_paritylogging.c	Tue May 10 07:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_paritylogging.c,v 1.28 2007/03/04 06:02:39 christos Exp $	*/
+/*	$NetBSD: rf_paritylogging.c,v 1.29 2011/05/10 07:04:17 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.28 2007/03/04 06:02:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.29 2011/05/10 07:04:17 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -637,8 +637,9 @@
 	}
 	while (raidPtr->parityLogDiskQueue.freeCommonList) {
 		c = raidPtr->parityLogDiskQueue.freeCommonList;
-		raidPtr->parityLogDiskQueue.freeCommonList =
-			raidPtr->parityLogDiskQueue.freeCommonList->next;
+		raidPtr->parityLogDiskQueue.freeCommonList = c->next;
+		/* init is in rf_paritylog.c */
+		rf_destroy_mutex2(c->mutex);
 		RF_Free(c, sizeof(RF_CommonLogData_t));
 	}
 }

Index: src/sys/dev/raidframe/rf_reconmap.c
diff -u src/sys/dev/raidframe/rf_reconmap.c:1.31 src/sys/dev/raidframe/rf_reconmap.c:1.32
--- src/sys/dev/raidframe/rf_reconmap.c:1.31	Mon May 19 19:49:54 2008
+++ src/sys/dev/raidframe/rf_reconmap.c	Tue May 10 07:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconmap.c,v 1.31 2008/05/19 19:49:54 oster Exp $	*/
+/*	$NetBSD: rf_reconmap.c,v 1.32 2011/05/10 07:04:17 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -34,7 +34,7 @@
  *************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.31 2008/05/19 19:49:54 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.32 2011/05/10 07:04:17 mrg Exp $");
 
 #include "rf_raid.h"
 #include <sys/time.h>
@@ -109,7 +109,9 @@
 	    0, 0, "raidreconpl", NULL, IPL_BIO);
 	pool_prime(&p->elem_pool, RF_NUM_RECON_POOL_ELEM);
 
-	rf_mutex_init(&p->mutex);
+	rf_init_mutex2(p->mutex, IPL_VM);
+	rf_init_cond2(p->cv, "reconupdate");
+
 	return (p);
 }
 
@@ -139,13 +141,12 @@
 	RF_SectorNum_t i, first_in_RU, last_in_RU, ru;
 	RF_ReconMapListElem_t *p, *pt;
 
-	RF_LOCK_MUTEX(mapPtr->mutex);
+	rf_lock_mutex2(mapPtr->mutex);
 	while(mapPtr->lock) {
-		ltsleep(&mapPtr->lock, PRIBIO, "reconupdate", 0, 
-			&mapPtr->mutex);
+		rf_wait_cond2(mapPtr->cv, mapPtr->mutex);
 	}
 	mapPtr->lock = 1;
-	RF_UNLOCK_MUTEX(mapPtr->mutex);
+	rf_unlock_mutex2(mapPtr->mutex);
 	RF_ASSERT(startSector >= 0 && stopSector < mapPtr->sectorsInDisk &&
 		  stopSector >= startSector);
 
@@ -211,10 +212,10 @@
 		}
 		startSector = RF_MIN(stopSector, last_in_RU) + 1;
 	}
-	RF_LOCK_MUTEX(mapPtr->mutex);    
+	rf_lock_mutex2(mapPtr->mutex);    
 	mapPtr->lock = 0;
-	wakeup(&mapPtr->lock);
-	RF_UNLOCK_MUTEX(mapPtr->mutex);
+	rf_broadcast_cond2(mapPtr->cv);
+	rf_unlock_mutex2(mapPtr->mutex);
 }
 
 
@@ -331,6 +332,9 @@
 		}
 	}
 
+	rf_destroy_mutex2(mapPtr->mutex);
+	rf_destroy_cond2(mapPtr->cv);
+
 	pool_destroy(&mapPtr->elem_pool);
 	RF_Free(mapPtr->status, mapPtr->status_size *
 		sizeof(RF_ReconMapListElem_t *));

Index: src/sys/dev/raidframe/rf_reconmap.h
diff -u src/sys/dev/raidframe/rf_reconmap.h:1.11 src/sys/dev/raidframe/rf_reconmap.h:1.12
--- src/sys/dev/raidframe/rf_reconmap.h:1.11	Mon May 19 19:49:54 2008
+++ src/sys/dev/raidframe/rf_reconmap.h	Tue May 10 07:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconmap.h,v 1.11 2008/05/19 19:49:54 oster Exp $	*/
+/*	$NetBSD: rf_reconmap.h,v 1.12 2011/05/10 07:04:17 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -63,7 +63,8 @@
 						 * stripes in array */
 	RF_ReconMapListElem_t **status;	/* array of ptrs to list elements */
 	struct pool elem_pool;          /* pool of RF_ReconMapListElem_t's */
-	RF_DECLARE_MUTEX(mutex)
+	rf_declare_mutex2(mutex);
+	rf_declare_cond2(cv);
 	int lock;                       /* 1 if someone has the recon map
 					   locked, 0 otherwise */
 };

Index: src/sys/dev/raidframe/rf_states.c
diff -u src/sys/dev/raidframe/rf_states.c:1.47 src/sys/dev/raidframe/rf_states.c:1.48
--- src/sys/dev/raidframe/rf_states.c:1.47	Thu May  5 07:12:58 2011
+++ src/sys/dev/raidframe/rf_states.c	Tue May 10 07:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_states.c,v 1.47 2011/05/05 07:12:58 mrg Exp $	*/
+/*	$NetBSD: rf_states.c,v 1.48 2011/05/10 07:04:17 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.47 2011/05/05 07:12:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.48 2011/05/10 07:04:17 mrg Exp $");
 
 #include <sys/errno.h>
 
@@ -217,10 +217,9 @@
 	callbackArg.p = desc->callbackArg;
 
 	/*
-	 * If this is not an async request, wake up the caller
+	 * We don't support non-async IO.
 	 */
-	if (desc->async_flag == 0)
-		wakeup(desc->bp);
+	KASSERT(desc->async_flag);
 
 	/*
 	 * That's all the IO for this one... unbusy the 'disk'.

Reply via email to