Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe convert the main raidPtr mutex to a kmutex...
details: https://anonhg.NetBSD.org/src/rev/b725054a59a9
branches: trunk
changeset: 764913:b725054a59a9
user: mrg <mrg%NetBSD.org@localhost>
date: Wed May 11 18:13:12 2011 +0000
description:
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.
diffstat:
sys/dev/raidframe/rf_copyback.c | 12 ++--
sys/dev/raidframe/rf_dagutils.c | 20 +++---
sys/dev/raidframe/rf_disks.c | 27 ++++----
sys/dev/raidframe/rf_driver.c | 33 +++++++----
sys/dev/raidframe/rf_engine.c | 6 +-
sys/dev/raidframe/rf_map.c | 12 ++--
sys/dev/raidframe/rf_netbsdkintf.c | 44 +++++++-------
sys/dev/raidframe/rf_paritylog.h | 4 +-
sys/dev/raidframe/rf_raid.h | 10 ++-
sys/dev/raidframe/rf_reconstruct.c | 106 ++++++++++++++++++------------------
sys/dev/raidframe/rf_reconutil.c | 8 +-
sys/dev/raidframe/rf_states.c | 10 +-
sys/dev/raidframe/rf_threadstuff.h | 19 +------
13 files changed, 153 insertions(+), 158 deletions(-)
diffs (truncated from 1056 to 300 lines):
diff -r 135517d82729 -r b725054a59a9 sys/dev/raidframe/rf_copyback.c
--- a/sys/dev/raidframe/rf_copyback.c Wed May 11 17:49:31 2011 +0000
+++ b/sys/dev/raidframe/rf_copyback.c Wed May 11 18:13:12 2011 +0000
@@ -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);
diff -r 135517d82729 -r b725054a59a9 sys/dev/raidframe/rf_dagutils.c
--- a/sys/dev/raidframe/rf_dagutils.c Wed May 11 17:49:31 2011 +0000
+++ b/sys/dev/raidframe/rf_dagutils.c Wed May 11 18:13:12 2011 +0000
@@ -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);
}
diff -r 135517d82729 -r b725054a59a9 sys/dev/raidframe/rf_disks.c
--- a/sys/dev/raidframe/rf_disks.c Wed May 11 17:49:31 2011 +0000
+++ b/sys/dev/raidframe/rf_disks.c Wed May 11 18:13:12 2011 +0000
@@ -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);
}
diff -r 135517d82729 -r b725054a59a9 sys/dev/raidframe/rf_driver.c
--- a/sys/dev/raidframe/rf_driver.c Wed May 11 17:49:31 2011 +0000
+++ b/sys/dev/raidframe/rf_driver.c Wed May 11 18:13:12 2011 +0000
@@ -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);
Home |
Main Index |
Thread Index |
Old Index