diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c index 0c3fd0fe8010..594d82d9b2c2 100644 --- a/sys/dev/raidframe/rf_copyback.c +++ b/sys/dev/raidframe/rf_copyback.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_copyback.c,v 1.45 2011/02/19 07:11:09 enami Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.46 2011/05/01 01:09:05 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,7 +38,7 @@ ****************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.45 2011/02/19 07:11:09 enami Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.46 2011/05/01 01:09:05 mrg Exp $"); #include @@ -350,17 +350,17 @@ rf_CopybackOne(RF_CopybackDesc_t *desc, int typ, RF_RaidAddr_t addr, * pair to complete. in the simulator, just return, since everything * will happen as callbacks */ - RF_LOCK_MUTEX(desc->mcpair->mutex); + RF_LOCK_MCPAIR(desc->mcpair); desc->mcpair->flag = 0; - RF_UNLOCK_MUTEX(desc->mcpair->mutex); + RF_UNLOCK_MCPAIR(desc->mcpair); rf_DiskIOEnqueue(&raidPtr->Queues[spCol], desc->readreq, RF_IO_NORMAL_PRIORITY); - RF_LOCK_MUTEX(desc->mcpair->mutex); + RF_LOCK_MCPAIR(desc->mcpair); while (!desc->mcpair->flag) { RF_WAIT_MCPAIR(desc->mcpair); } - RF_UNLOCK_MUTEX(desc->mcpair->mutex); + RF_UNLOCK_MCPAIR(desc->mcpair); rf_FreeDiskQueueData(desc->readreq); rf_FreeDiskQueueData(desc->writereq); diff --git a/sys/dev/raidframe/rf_mcpair.c b/sys/dev/raidframe/rf_mcpair.c index 657968b86f27..c88a74db44af 100644 --- a/sys/dev/raidframe/rf_mcpair.c +++ b/sys/dev/raidframe/rf_mcpair.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_mcpair.c,v 1.23 2011/04/30 01:44:36 mrg Exp $ */ +/* $NetBSD: rf_mcpair.c,v 1.24 2011/05/01 01:09:05 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.23 2011/04/30 01:44:36 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.24 2011/05/01 01:09:05 mrg Exp $"); #include @@ -75,8 +75,8 @@ rf_AllocMCPair(void) RF_MCPair_t *t; t = pool_get(&rf_pools.mcpair, PR_WAITOK); - rf_mutex_init(&t->mutex); - t->cond = 0; + rf_init_mutex2(t->mutex, IPL_VM); + rf_init_cond2(t->cond, "mcpair"); t->flag = 0; return (t); @@ -85,6 +85,8 @@ rf_AllocMCPair(void) void rf_FreeMCPair(RF_MCPair_t *t) { + rf_destroy_cond2(t->cond); + rf_destroy_mutex2(t->mutex); pool_put(&rf_pools.mcpair, t); } @@ -93,8 +95,8 @@ rf_FreeMCPair(RF_MCPair_t *t) void rf_MCPairWakeupFunc(RF_MCPair_t *mcpair) { - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(mcpair); mcpair->flag = 1; - wakeup(&(mcpair->cond)); - RF_UNLOCK_MUTEX(mcpair->mutex); + rf_broadcast_cond2(mcpair->cond); + RF_UNLOCK_MCPAIR(mcpair); } diff --git a/sys/dev/raidframe/rf_mcpair.h b/sys/dev/raidframe/rf_mcpair.h index 063545d757fc..e3162a793ee0 100644 --- a/sys/dev/raidframe/rf_mcpair.h +++ b/sys/dev/raidframe/rf_mcpair.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_mcpair.h,v 1.9 2005/12/11 12:23:37 christos Exp $ */ +/* $NetBSD: rf_mcpair.h,v 1.10 2011/05/01 01:09:05 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,12 +37,13 @@ #include "rf_threadstuff.h" struct RF_MCPair_s { - RF_DECLARE_MUTEX(mutex) - RF_DECLARE_COND(cond) + rf_declare_mutex2(mutex); + rf_declare_cond2(cond); int flag; }; -#define RF_WAIT_MCPAIR(_mcp) \ - ltsleep(&((_mcp)->cond), PRIBIO, "mcpair", 0, &((_mcp)->mutex)) +#define RF_WAIT_MCPAIR(_mcp) rf_wait_cond2((_mcp)->cond, (_mcp)->mutex) +#define RF_LOCK_MCPAIR(_mcp) rf_lock_mutex2((_mcp)->mutex) +#define RF_UNLOCK_MCPAIR(_mcp) rf_unlock_mutex2((_mcp)->mutex) int rf_ConfigureMCPair(RF_ShutdownList_t ** listp); RF_MCPair_t *rf_AllocMCPair(void); diff --git a/sys/dev/raidframe/rf_parityscan.c b/sys/dev/raidframe/rf_parityscan.c index ad916d379594..4c61afcddc8f 100644 --- a/sys/dev/raidframe/rf_parityscan.c +++ b/sys/dev/raidframe/rf_parityscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityscan.c,v 1.33 2009/11/17 18:54:26 jld Exp $ */ +/* $NetBSD: rf_parityscan.c,v 1.34 2011/05/01 01:09:05 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ****************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.33 2009/11/17 18:54:26 jld Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.34 2011/05/01 01:09:05 mrg Exp $"); #include @@ -262,17 +262,17 @@ rf_VerifyParityBasic(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_UNLOCK_MUTEX(mcpair->mutex); + RF_UNLOCK_MCPAIR(mcpair); rf_DispatchDAG(rd_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(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; @@ -308,17 +308,17 @@ rf_VerifyParityBasic(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_UNLOCK_MUTEX(mcpair->mutex); + RF_UNLOCK_MCPAIR(mcpair); rf_DispatchDAG(wr_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(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"); retcode = RF_PARITY_COULD_NOT_CORRECT; diff --git a/sys/dev/raidframe/rf_raid1.c b/sys/dev/raidframe/rf_raid1.c index 0acea3e263cf..40fa4347af94 100644 --- a/sys/dev/raidframe/rf_raid1.c +++ b/sys/dev/raidframe/rf_raid1.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.c,v 1.32 2010/04/15 15:49:00 oster Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.33 2011/05/01 01:09:05 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ *****************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.32 2010/04/15 15:49:00 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.33 2011/05/01 01:09:05 mrg Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -378,18 +378,18 @@ rf_VerifyParityRAID1(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_UNLOCK_MUTEX(mcpair->mutex); + RF_UNLOCK_MCPAIR(mcpair); rf_DispatchDAG(rd_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(mcpair); while (mcpair->flag == 0) { RF_WAIT_MCPAIR(mcpair); } - RF_UNLOCK_MUTEX(mcpair->mutex); + RF_UNLOCK_MCPAIR(mcpair); if (rd_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to verify raid1 parity: can't read stripe\n"); @@ -497,19 +497,19 @@ rf_VerifyParityRAID1(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_UNLOCK_MUTEX(mcpair->mutex); + RF_UNLOCK_MCPAIR(mcpair); /* fire off the write DAG */ rf_DispatchDAG(wr_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc, (void *) mcpair); - RF_LOCK_MUTEX(mcpair->mutex); + RF_LOCK_MCPAIR(mcpair); while (!mcpair->flag) { - RF_WAIT_COND(mcpair->cond, mcpair->mutex); + RF_WAIT_MCPAIR(mcpair); } - RF_UNLOCK_MUTEX(mcpair->mutex); + RF_UNLOCK_MCPAIR(mcpair); if (wr_dag_h->status != rf_enable) { RF_ERRORMSG("Unable to correct RAID1 parity in VerifyParity\n"); goto done;