summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2011-05-10 07:04:17 +0000
committermrg <mrg@NetBSD.org>2011-05-10 07:04:17 +0000
commitcbda67a728a55c882598d09208bf7bcb5d26474e (patch)
treee787223a08d0e7471c83f0bfa746bafef1ca2f8c /sys/dev/raidframe
parentdb0680aeb1fc7e39d7bb188b1eca149a4f140e37 (diff)
convert RF_CommonLogData_s/RF_ReconMap_s mutex to a kmutex/cv.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_paritylog.c11
-rw-r--r--sys/dev/raidframe/rf_paritylog.h6
-rw-r--r--sys/dev/raidframe/rf_paritylogging.c9
-rw-r--r--sys/dev/raidframe/rf_reconmap.c24
-rw-r--r--sys/dev/raidframe/rf_reconmap.h5
-rw-r--r--sys/dev/raidframe/rf_states.c9
6 files changed, 35 insertions, 29 deletions
diff --git a/sys/dev/raidframe/rf_paritylog.c b/sys/dev/raidframe/rf_paritylog.c
index 7edaca55b9a..a8332b26ecb 100644
--- a/sys/dev/raidframe/rf_paritylog.c
+++ b/sys/dev/raidframe/rf_paritylog.c
@@ -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 @@ AllocParityLogCommonData(RF_Raid_t * raidPtr)
} 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 @@ rf_ParityLogAppend(
/* 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
diff --git a/sys/dev/raidframe/rf_paritylog.h b/sys/dev/raidframe/rf_paritylog.h
index 67861c30f65..1496d726ffe 100644
--- a/sys/dev/raidframe/rf_paritylog.h
+++ b/sys/dev/raidframe/rf_paritylog.h
@@ -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 @@ typedef enum RF_ParityRecordType_e {
} 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);
diff --git a/sys/dev/raidframe/rf_paritylogging.c b/sys/dev/raidframe/rf_paritylogging.c
index c51f9f38152..fad5fa0ad73 100644
--- a/sys/dev/raidframe/rf_paritylogging.c
+++ b/sys/dev/raidframe/rf_paritylogging.c
@@ -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 @@ rf_ShutdownParityLoggingDiskQueue(RF_ThreadArg_t arg)
}
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));
}
}
diff --git a/sys/dev/raidframe/rf_reconmap.c b/sys/dev/raidframe/rf_reconmap.c
index 62386a24fef..60ae9203a3c 100644
--- a/sys/dev/raidframe/rf_reconmap.c
+++ b/sys/dev/raidframe/rf_reconmap.c
@@ -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 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors,
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_ReconMapUpdate(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr,
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 @@ rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr,
}
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_FreeReconMap(RF_ReconMap_t *mapPtr)
}
}
+ 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 *));
diff --git a/sys/dev/raidframe/rf_reconmap.h b/sys/dev/raidframe/rf_reconmap.h
index 0091843bcec..cc6b603e0d5 100644
--- a/sys/dev/raidframe/rf_reconmap.h
+++ b/sys/dev/raidframe/rf_reconmap.h
@@ -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 @@ struct RF_ReconMap_s {
* 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 */
};
diff --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c
index 5a093e6608d..2743bf81f4c 100644
--- a/sys/dev/raidframe/rf_states.c
+++ b/sys/dev/raidframe/rf_states.c
@@ -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 @@ rf_State_LastState(RF_RaidAccessDesc_t *desc)
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'.