Module Name: src Committed By: mrg Date: Sun May 1 01:09:05 UTC 2011
Modified Files: src/sys/dev/raidframe: rf_copyback.c rf_mcpair.c rf_mcpair.h rf_parityscan.c rf_raid1.c Log Message: convert mcpair to kmutex. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.23 -r1.24 src/sys/dev/raidframe/rf_mcpair.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_mcpair.h cvs rdiff -u -r1.33 -r1.34 src/sys/dev/raidframe/rf_parityscan.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_raid1.c 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_copyback.c diff -u src/sys/dev/raidframe/rf_copyback.c:1.45 src/sys/dev/raidframe/rf_copyback.c:1.46 --- src/sys/dev/raidframe/rf_copyback.c:1.45 Sat Feb 19 07:11:09 2011 +++ src/sys/dev/raidframe/rf_copyback.c Sun May 1 01:09:05 2011 @@ -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 <sys/cdefs.h> -__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 <dev/raidframe/raidframevar.h> @@ -350,17 +350,17 @@ * 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); Index: src/sys/dev/raidframe/rf_mcpair.c diff -u src/sys/dev/raidframe/rf_mcpair.c:1.23 src/sys/dev/raidframe/rf_mcpair.c:1.24 --- src/sys/dev/raidframe/rf_mcpair.c:1.23 Sat Apr 30 01:44:36 2011 +++ src/sys/dev/raidframe/rf_mcpair.c Sun May 1 01:09:05 2011 @@ -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 <sys/cdefs.h> -__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 <dev/raidframe/raidframevar.h> @@ -75,8 +75,8 @@ 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 @@ 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 @@ 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); } Index: src/sys/dev/raidframe/rf_mcpair.h diff -u src/sys/dev/raidframe/rf_mcpair.h:1.9 src/sys/dev/raidframe/rf_mcpair.h:1.10 --- src/sys/dev/raidframe/rf_mcpair.h:1.9 Sun Dec 11 12:23:37 2005 +++ src/sys/dev/raidframe/rf_mcpair.h Sun May 1 01:09:05 2011 @@ -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); Index: src/sys/dev/raidframe/rf_parityscan.c diff -u src/sys/dev/raidframe/rf_parityscan.c:1.33 src/sys/dev/raidframe/rf_parityscan.c:1.34 --- src/sys/dev/raidframe/rf_parityscan.c:1.33 Tue Nov 17 18:54:26 2009 +++ src/sys/dev/raidframe/rf_parityscan.c Sun May 1 01:09:05 2011 @@ -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 <sys/cdefs.h> -__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 <dev/raidframe/raidframevar.h> @@ -262,17 +262,17 @@ 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_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; Index: src/sys/dev/raidframe/rf_raid1.c diff -u src/sys/dev/raidframe/rf_raid1.c:1.32 src/sys/dev/raidframe/rf_raid1.c:1.33 --- src/sys/dev/raidframe/rf_raid1.c:1.32 Thu Apr 15 15:49:00 2010 +++ src/sys/dev/raidframe/rf_raid1.c Sun May 1 01:09:05 2011 @@ -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 <sys/cdefs.h> -__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_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_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;