convert reintMutex to a kmutex.

This commit is contained in:
mrg 2011-05-11 03:38:32 +00:00
parent 32ab76b94a
commit 3dd617695f
4 changed files with 19 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_paritylog.c,v 1.15 2011/05/11 03:23:26 mrg Exp $ */
/* $NetBSD: rf_paritylog.c,v 1.16 2011/05/11 03:38:32 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.15 2011/05/11 03:23:26 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.16 2011/05/11 03:38:32 mrg Exp $");
#include "rf_archs.h"
@ -548,7 +548,7 @@ ReintLog(
* specified region (regionID) to indicate that reintegration is in
* progress for this region. NON-BLOCKING */
RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
raidPtr->regionInfo[regionID].reintInProgress = RF_TRUE; /* cleared when reint
* complete */
@ -558,7 +558,7 @@ ReintLog(
rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
log->next = raidPtr->parityLogDiskQueue.reintQueue;
raidPtr->parityLogDiskQueue.reintQueue = log;
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
rf_signal_cond2(raidPtr->parityLogDiskQueue.cond);
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
}
@ -612,7 +612,7 @@ DumpParityLogToDisk(
RF_ASSERT(log->next == NULL);
/* if reintegration is in progress, must queue work */
RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
if (raidPtr->regionInfo[regionID].reintInProgress) {
/* Can not proceed since this region is currently being
* reintegrated. We can not block, so queue remaining work and
@ -625,10 +625,10 @@ DumpParityLogToDisk(
RequeueParityLogData(logData, &raidPtr->parityLogDiskQueue.reintBlockHead, &raidPtr->parityLogDiskQueue.reintBlockTail);
else
EnqueueParityLogData(logData, &raidPtr->parityLogDiskQueue.reintBlockHead, &raidPtr->parityLogDiskQueue.reintBlockTail);
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
return (1); /* relenquish control of this thread */
}
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
raidPtr->regionInfo[regionID].coreLog = NULL;
if ((raidPtr->regionInfo[regionID].diskCount) < raidPtr->regionInfo[regionID].capacity)
/* IMPORTANT!! this loop bound assumes region disk holds an
@ -695,13 +695,13 @@ rf_ParityLogAppend(
if (clearReintFlag) {
/* Enable flushing for this region. Holding both locks
* provides a synchronization barrier with DumpParityLogToDisk */
RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
/* XXXmrg need this? */
rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
RF_ASSERT(raidPtr->regionInfo[regionID].reintInProgress == RF_TRUE);
raidPtr->regionInfo[regionID].diskCount = 0;
raidPtr->regionInfo[regionID].reintInProgress = RF_FALSE;
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex); /* flushing is now
rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex); /* flushing is now
* enabled */
/* XXXmrg need this? */
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_paritylog.h,v 1.7 2011/05/11 03:23:26 mrg Exp $ */
/* $NetBSD: rf_paritylog.h,v 1.8 2011/05/11 03:38:32 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -146,7 +146,7 @@ struct RF_DiskMap_s {
struct RF_RegionInfo_s {
RF_DECLARE_MUTEX(mutex) /* protects: diskCount, diskMap,
* loggingEnabled, coreLog */
RF_DECLARE_MUTEX(reintMutex) /* protects: reintInProgress */
rf_declare_mutex2(reintMutex); /* protects: reintInProgress */
int reintInProgress;/* flag used to suspend flushing operations */
RF_SectorCount_t capacity; /* capacity of this region in sectors */
RF_SectorNum_t regionStartAddr; /* starting disk address for this

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_paritylogDiskMgr.c,v 1.25 2011/05/11 03:23:26 mrg Exp $ */
/* $NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 mrg Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.25 2011/05/11 03:23:26 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 mrg Exp $");
#include "rf_archs.h"
@ -535,13 +535,13 @@ ReintegrateLogs(
* locks provides a synchronization barrier with
* DumpParityLogToDisk */
RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
/* XXXmrg: don't need this? */
rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
raidPtr->regionInfo[regionID].diskCount = 0;
raidPtr->regionInfo[regionID].reintInProgress = RF_FALSE;
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex); /* flushing is now
rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex); /* flushing is now
* enabled */
/* XXXmrg: don't need this? */
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_paritylogging.c,v 1.30 2011/05/11 03:23:26 mrg Exp $ */
/* $NetBSD: rf_paritylogging.c,v 1.31 2011/05/11 03:38:32 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.30 2011/05/11 03:23:26 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.31 2011/05/11 03:38:32 mrg Exp $");
#include "rf_archs.h"
@ -411,7 +411,7 @@ rf_ConfigureParityLogging(
raidPtr);
for (i = 0; i < rf_numParityRegions; i++) {
rf_mutex_init(&raidPtr->regionInfo[i].mutex);
rf_mutex_init(&raidPtr->regionInfo[i].reintMutex);
rf_init_mutex2(raidPtr->regionInfo[i].reintMutex, IPL_VM);
raidPtr->regionInfo[i].reintInProgress = RF_FALSE;
raidPtr->regionInfo[i].regionStartAddr =
raidPtr->regionLogCapacity * i;
@ -513,6 +513,7 @@ FreeRegionInfo(
RF_ASSERT(raidPtr->regionInfo[regionID].diskCount == 0);
}
RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
rf_destroy_mutex2(raidPtr->regionInfo[regionID].reintMutex);
}