From 50fe584a382430850e2354816aea74d71c44218a Mon Sep 17 00:00:00 2001 From: mrg Date: Thu, 5 May 2011 04:20:51 +0000 Subject: [PATCH] finish porting mcpair users to kmutex, and fix a couple of declarations in rf_netbsdkintf.c. fixes i386/conf/ALL build. --- sys/dev/raidframe/rf_evenodd.c | 22 +++++++++---------- sys/dev/raidframe/rf_netbsdkintf.c | 16 +++++++------- sys/dev/raidframe/rf_paritylogDiskMgr.c | 28 ++++++++++++------------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/sys/dev/raidframe/rf_evenodd.c b/sys/dev/raidframe/rf_evenodd.c index 3759c5d42c99..626a1bb9d6b0 100644 --- a/sys/dev/raidframe/rf_evenodd.c +++ b/sys/dev/raidframe/rf_evenodd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_evenodd.c,v 1.19 2007/01/29 01:52:45 hubertf Exp $ */ +/* $NetBSD: rf_evenodd.c,v 1.20 2011/05/05 04:20:51 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ****************************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_evenodd.c,v 1.19 2007/01/29 01:52:45 hubertf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_evenodd.c,v 1.20 2011/05/05 04:20:51 mrg Exp $"); #include "rf_archs.h" @@ -411,13 +411,13 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, rf_PrintDAGList(rd_dag_h); } #endif - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(mcpair); mcpair->flag = 0; rf_DispatchDAG(rd_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); while (!mcpair->flag) - RF_WAIT_COND(mcpair->cond, mcpair->mutex); - RF_UNLOCK_MUTEX(mcpair->mutex); + RF_WAIT_MCPAIR(mcpair); + RF_UNLOCK_MCPAIR(mcpair); if (rd_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to verify parity: can't read the stripe\n"); retcode = RF_PARITY_COULD_NOT_VERIFY; @@ -473,13 +473,13 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, rf_PrintDAGList(wr_dag_h); } #endif - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(mcpair); mcpair->flag = 0; rf_DispatchDAG(wr_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); while (!mcpair->flag) - RF_WAIT_COND(mcpair->cond, mcpair->mutex); - RF_UNLOCK_MUTEX(mcpair->mutex); + RF_WAIT_MCPAIR(mcpair); + RF_UNLOCK_MCPAIR(mcpair); if (wr_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to correct parity in VerifyParity: can't write the stripe\n"); parity_cant_correct = RF_TRUE; @@ -504,13 +504,13 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, rf_PrintDAGList(wr_dag_h); } #endif - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(mcpair); mcpair->flag = 0; rf_DispatchDAG(wr_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); while (!mcpair->flag) - RF_WAIT_COND(mcpair->cond, mcpair->mutex); - RF_UNLOCK_MUTEX(mcpair->mutex); + RF_WAIT_MCPAIR(mcpair); + RF_UNLOCK_MCPAIR(mcpair); if (wr_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to correct second redundant information in VerifyParity: can't write the stripe\n"); red2_cant_correct = RF_TRUE; diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 91e8b7518450..d115065b81bb 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.288 2011/05/01 06:22:54 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.289 2011/05/05 04:20:51 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***********************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.288 2011/05/01 06:22:54 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.289 2011/05/05 04:20:51 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -162,7 +162,7 @@ int rf_kdebug_level = 0; static RF_Raid_t **raidPtrs; /* global raid device descriptors */ #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0) -static rf_declare_mutex2(rf_sparet_wait_mutex): +static rf_declare_mutex2(rf_sparet_wait_mutex); static rf_declare_cond2(rf_sparet_wait_cv); static rf_declare_cond2(rf_sparet_resp_cv); @@ -341,9 +341,9 @@ raidattach(int num) } #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0) - rf_init_mutex2(&rf_sparet_wait_mutex); - rf_init_cond2(&rf_sparet_wait_cv, "sparetw"); - rf_init_cond2(&rf_sparet_resp_cv, "rfgst"); + rf_init_mutex2(rf_sparet_wait_mutex, IPL_VM); + rf_init_cond2(rf_sparet_wait_cv, "sparetw"); + rf_init_cond2(rf_sparet_resp_cv, "rfgst"); rf_sparet_wait_queue = rf_sparet_resp_queue = NULL; #endif @@ -1930,11 +1930,11 @@ rf_GetSpareTableFromDaemon(RF_SparetWait_t *req) rf_lock_mutex2(rf_sparet_wait_mutex); req->next = rf_sparet_wait_queue; rf_sparet_wait_queue = req; - rf_broadcast_conf2(rf_sparet_wait_cv); + rf_broadcast_cond2(rf_sparet_wait_cv); /* mpsleep unlocks the mutex */ while (!rf_sparet_resp_queue) { - cv_wait(rf_sparet_resp_cv, rf_sparet_resp_mutex); + rf_wait_cond2(rf_sparet_resp_cv, rf_sparet_wait_mutex); } req = rf_sparet_resp_queue; rf_sparet_resp_queue = req->next; diff --git a/sys/dev/raidframe/rf_paritylogDiskMgr.c b/sys/dev/raidframe/rf_paritylogDiskMgr.c index 55104d3517e6..f667a9936e6c 100644 --- a/sys/dev/raidframe/rf_paritylogDiskMgr.c +++ b/sys/dev/raidframe/rf_paritylogDiskMgr.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylogDiskMgr.c,v 1.23 2009/03/14 15:36:20 dsl Exp $ */ +/* $NetBSD: rf_paritylogDiskMgr.c,v 1.24 2011/05/05 04:20:51 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.23 2009/03/14 15:36:20 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.24 2011/05/05 04:20:51 mrg Exp $"); #include "rf_archs.h" @@ -338,7 +338,7 @@ FlushLogsToDisk( RF_PhysDiskAddr_t *fwr_pda; fwr_mcpair = rf_AllocMCPair(); - RF_LOCK_MUTEX(fwr_mcpair->mutex); + RF_LOCK_MCPAIR(fwr_mcpair); RF_ASSERT(logList); log = logList; @@ -354,7 +354,7 @@ FlushLogsToDisk( /* wait for the DAG to complete */ while (!fwr_mcpair->flag) - RF_WAIT_COND(fwr_mcpair->cond, fwr_mcpair->mutex); + RF_WAIT_MCPAIR(fwr_mcpair); if (fwr_dag_h->status != rf_enable) { RF_ERRORMSG1("Unable to write core log to disk (region %d)\n", regionID); RF_ASSERT(0); @@ -366,7 +366,7 @@ FlushLogsToDisk( log = log->next; } - RF_UNLOCK_MUTEX(fwr_mcpair->mutex); + RF_UNLOCK_MCPAIR(fwr_mcpair); rf_FreeMCPair(fwr_mcpair); rf_ReleaseParityLogs(raidPtr, logList); } @@ -402,7 +402,7 @@ ReintegrateRegion( printf("[initiating read of parity for region %d]\n",regionID); parityBuffer = AcquireReintBuffer(&raidPtr->parityBufferPool); prd_mcpair = rf_AllocMCPair(); - RF_LOCK_MUTEX(prd_mcpair->mutex); + RF_LOCK_MCPAIR(prd_mcpair); prd_mcpair->flag = RF_FALSE; ReadRegionParity(regionID, prd_mcpair, parityBuffer, raidPtr, &prd_dag_h, &prd_alloclist, &prd_pda); @@ -414,16 +414,16 @@ ReintegrateRegion( regionID); regionBuffer = AcquireReintBuffer(&raidPtr->regionBufferPool); rrd_mcpair = rf_AllocMCPair(); - RF_LOCK_MUTEX(rrd_mcpair->mutex); + RF_LOCK_MCPAIR(rrd_mcpair); rrd_mcpair->flag = RF_FALSE; ReadRegionLog(regionID, rrd_mcpair, regionBuffer, raidPtr, &rrd_dag_h, &rrd_alloclist, &rrd_pda); } /* wait on read of region parity to complete */ while (!prd_mcpair->flag) { - RF_WAIT_COND(prd_mcpair->cond, prd_mcpair->mutex); + RF_WAIT_MCPAIR(prd_mcpair); } - RF_UNLOCK_MUTEX(prd_mcpair->mutex); + RF_UNLOCK_MCPAIR(prd_mcpair); if (prd_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to read parity from disk\n"); /* add code to fail the parity disk */ @@ -435,8 +435,8 @@ ReintegrateRegion( if (raidPtr->regionInfo[regionID].diskCount > 0) { /* wait on read of region log to complete */ while (!rrd_mcpair->flag) - RF_WAIT_COND(rrd_mcpair->cond, rrd_mcpair->mutex); - RF_UNLOCK_MUTEX(rrd_mcpair->mutex); + RF_WAIT_MCPAIR(rrd_mcpair); + RF_UNLOCK_MCPAIR(rrd_mcpair); if (rrd_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to read region log from disk\n"); /* add code to fail the log disk */ @@ -457,13 +457,13 @@ ReintegrateRegion( printf("[initiating write of parity for region %d]\n", regionID); pwr_mcpair = rf_AllocMCPair(); - RF_LOCK_MUTEX(pwr_mcpair->mutex); + RF_LOCK_MCPAIR(pwr_mcpair); pwr_mcpair->flag = RF_FALSE; WriteRegionParity(regionID, pwr_mcpair, parityBuffer, raidPtr, &pwr_dag_h, &pwr_alloclist, &pwr_pda); while (!pwr_mcpair->flag) - RF_WAIT_COND(pwr_mcpair->cond, pwr_mcpair->mutex); - RF_UNLOCK_MUTEX(pwr_mcpair->mutex); + RF_WAIT_MCPAIR(pwr_mcpair); + RF_UNLOCK_MCPAIR(pwr_mcpair); if (pwr_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to write parity to disk\n"); /* add code to fail the parity disk */