Module Name: src Committed By: mrg Date: Wed May 11 05:14:07 UTC 2011
Modified Files: src/sys/dev/raidframe: rf_paritylog.c rf_paritylog.h rf_paritylogDiskMgr.c rf_paritylogging.c rf_threadstuff.h Log Message: convert regionInfo[regionID].mutex to a kmutex. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_paritylog.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/raidframe/rf_paritylog.h cvs rdiff -u -r1.26 -r1.27 src/sys/dev/raidframe/rf_paritylogDiskMgr.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_paritylogging.c \ 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_paritylog.c diff -u src/sys/dev/raidframe/rf_paritylog.c:1.16 src/sys/dev/raidframe/rf_paritylog.c:1.17 --- src/sys/dev/raidframe/rf_paritylog.c:1.16 Wed May 11 03:38:32 2011 +++ src/sys/dev/raidframe/rf_paritylog.c Wed May 11 05:14:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylog.c,v 1.16 2011/05/11 03:38:32 mrg Exp $ */ +/* $NetBSD: rf_paritylog.c,v 1.17 2011/05/11 05:14:07 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.16 2011/05/11 03:38:32 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.17 2011/05/11 05:14:07 mrg Exp $"); #include "rf_archs.h" @@ -605,6 +605,8 @@ * * NON-BLOCKING */ + RF_ASSERT(rf_owned_mutex2(raidPtr->regionInfo[regionID].mutex)); + if (rf_parityLogDebug) printf("[dumping parity log to disk, region %d]\n", regionID); log = raidPtr->regionInfo[regionID].coreLog; @@ -689,7 +691,7 @@ /* lock the region for the first item in logData */ RF_ASSERT(logData != NULL); regionID = logData->regionID; - RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex); RF_ASSERT(raidPtr->regionInfo[regionID].loggingEnabled); if (clearReintFlag) { @@ -719,9 +721,9 @@ /* see if we moved to a new region */ if (regionID != item->regionID) { - RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex); regionID = item->regionID; - RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex); RF_ASSERT(raidPtr->regionInfo[regionID].loggingEnabled); } punt = RF_FALSE;/* Set to RF_TRUE if work is blocked. This @@ -845,7 +847,7 @@ FreeParityLogData(item); } } - RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex); if (rf_parityLogDebug) printf("[exiting ParityLogAppend]\n"); return (0); @@ -858,9 +860,9 @@ int regionID; for (regionID = 0; regionID < rf_numParityRegions; regionID++) { - RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex); raidPtr->regionInfo[regionID].loggingEnabled = RF_TRUE; - RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex); } if (rf_parityLogDebug) printf("[parity logging enabled]\n"); Index: src/sys/dev/raidframe/rf_paritylog.h diff -u src/sys/dev/raidframe/rf_paritylog.h:1.8 src/sys/dev/raidframe/rf_paritylog.h:1.9 --- src/sys/dev/raidframe/rf_paritylog.h:1.8 Wed May 11 03:38:32 2011 +++ src/sys/dev/raidframe/rf_paritylog.h Wed May 11 05:14:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylog.h,v 1.8 2011/05/11 03:38:32 mrg Exp $ */ +/* $NetBSD: rf_paritylog.h,v 1.9 2011/05/11 05:14:07 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -144,8 +144,8 @@ }; struct RF_RegionInfo_s { - RF_DECLARE_MUTEX(mutex) /* protects: diskCount, diskMap, - * loggingEnabled, coreLog */ + rf_declare_mutex2(mutex); /* protects: diskCount, diskMap, + * loggingEnabled, coreLog */ rf_declare_mutex2(reintMutex); /* protects: reintInProgress */ int reintInProgress;/* flag used to suspend flushing operations */ RF_SectorCount_t capacity; /* capacity of this region in sectors */ Index: src/sys/dev/raidframe/rf_paritylogDiskMgr.c diff -u src/sys/dev/raidframe/rf_paritylogDiskMgr.c:1.26 src/sys/dev/raidframe/rf_paritylogDiskMgr.c:1.27 --- src/sys/dev/raidframe/rf_paritylogDiskMgr.c:1.26 Wed May 11 03:38:32 2011 +++ src/sys/dev/raidframe/rf_paritylogDiskMgr.c Wed May 11 05:14:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 mrg Exp $ */ +/* $NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 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.26 2011/05/11 03:38:32 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 mrg Exp $"); #include "rf_archs.h" @@ -534,13 +534,13 @@ /* Enable flushing for this region. Holding both * locks provides a synchronization barrier with * DumpParityLogToDisk */ - RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex); 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_mutex2(raidPtr->regionInfo[regionID].mutex); rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex); /* flushing is now * enabled */ /* XXXmrg: don't need this? */ @@ -573,13 +573,13 @@ * regions. */ if (rf_forceParityLogReint) { for (regionID = 0; regionID < rf_numParityRegions; regionID++) { - RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_lock_mutex2(raidPtr->regionInfo[regionID].mutex); raidPtr->regionInfo[regionID].loggingEnabled = RF_FALSE; log = raidPtr->regionInfo[regionID].coreLog; raidPtr->regionInfo[regionID].coreLog = NULL; diskCount = raidPtr->regionInfo[regionID].diskCount; - RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); + rf_unlock_mutex2(raidPtr->regionInfo[regionID].mutex); if (diskCount > 0 || log != NULL) ReintegrateRegion(raidPtr, regionID, log); if (log != NULL) Index: src/sys/dev/raidframe/rf_paritylogging.c diff -u src/sys/dev/raidframe/rf_paritylogging.c:1.31 src/sys/dev/raidframe/rf_paritylogging.c:1.32 --- src/sys/dev/raidframe/rf_paritylogging.c:1.31 Wed May 11 03:38:32 2011 +++ src/sys/dev/raidframe/rf_paritylogging.c Wed May 11 05:14:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylogging.c,v 1.31 2011/05/11 03:38:32 mrg Exp $ */ +/* $NetBSD: rf_paritylogging.c,v 1.32 2011/05/11 05:14:07 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.31 2011/05/11 03:38:32 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.32 2011/05/11 05:14:07 mrg Exp $"); #include "rf_archs.h" @@ -410,7 +410,7 @@ rf_ShutdownParityLoggingDiskQueue, raidPtr); for (i = 0; i < rf_numParityRegions; i++) { - rf_mutex_init(&raidPtr->regionInfo[i].mutex); + rf_init_mutex2(raidPtr->regionInfo[i].mutex, IPL_VM); rf_init_mutex2(raidPtr->regionInfo[i].reintMutex, IPL_VM); raidPtr->regionInfo[i].reintInProgress = RF_FALSE; raidPtr->regionInfo[i].regionStartAddr = @@ -500,7 +500,6 @@ RF_Raid_t * raidPtr, RF_RegionId_t regionID) { - RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); RF_Free(raidPtr->regionInfo[regionID].diskMap, (raidPtr->regionInfo[regionID].capacity * sizeof(RF_DiskMap_t))); @@ -512,8 +511,8 @@ RF_ASSERT(raidPtr->regionInfo[regionID].coreLog == NULL); RF_ASSERT(raidPtr->regionInfo[regionID].diskCount == 0); } - RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); rf_destroy_mutex2(raidPtr->regionInfo[regionID].reintMutex); + rf_destroy_mutex2(raidPtr->regionInfo[regionID].mutex); } Index: src/sys/dev/raidframe/rf_threadstuff.h diff -u src/sys/dev/raidframe/rf_threadstuff.h:1.31 src/sys/dev/raidframe/rf_threadstuff.h:1.32 --- src/sys/dev/raidframe/rf_threadstuff.h:1.31 Thu May 5 08:21:09 2011 +++ src/sys/dev/raidframe/rf_threadstuff.h Wed May 11 05:14:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_threadstuff.h,v 1.31 2011/05/05 08:21:09 mrg Exp $ */ +/* $NetBSD: rf_threadstuff.h,v 1.32 2011/05/11 05:14:07 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -83,6 +83,8 @@ #define rf_init_mutex2(_m_, _p_) mutex_init(&(_m_), MUTEX_DEFAULT, (_p_)) #define rf_destroy_mutex2(_m_) mutex_destroy(&(_m_)) +#define rf_owned_mutex2(_m_) mutex_owned(&(_m_)) + #define rf_init_cond2(_c_, _w_) cv_init(&(_c_), (_w_)) #define rf_destroy_cond2(_c_) cv_destroy(&(_c_))