diff --git a/sys/dev/raidframe/rf_dag.h b/sys/dev/raidframe/rf_dag.h index 0cfa3960914f..2a6dbbaf1d7d 100644 --- a/sys/dev/raidframe/rf_dag.h +++ b/sys/dev/raidframe/rf_dag.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dag.h,v 1.12 2004/03/18 16:40:05 oster Exp $ */ +/* $NetBSD: rf_dag.h,v 1.13 2004/03/19 15:16:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -170,6 +170,8 @@ struct RF_DagHeader_s { void *cbArg; /* argument for cbFunc */ char *creator; /* name of function used to create this dag */ RF_DagNode_t *nodes; /* linked list of nodes used in this DAG */ + RF_PhysDiskAddr_t *pda_cleanup_list; /* for PDAs that can't get + cleaned up any other way... */ RF_Raid_t *raidPtr; /* the descriptor for the RAID device this DAG * is for */ void *bp; /* the bp for this I/O passed down from the diff --git a/sys/dev/raidframe/rf_dagdegrd.c b/sys/dev/raidframe/rf_dagdegrd.c index 460de7eda522..a75ae355ae9a 100644 --- a/sys/dev/raidframe/rf_dagdegrd.c +++ b/sys/dev/raidframe/rf_dagdegrd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagdegrd.c,v 1.20 2004/03/18 16:40:05 oster Exp $ */ +/* $NetBSD: rf_dagdegrd.c,v 1.21 2004/03/19 15:16:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.20 2004/03/18 16:40:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.21 2004/03/19 15:16:18 oster Exp $"); #include @@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.20 2004/03/18 16:40:05 oster Exp $ #include "rf_debugMem.h" #include "rf_general.h" #include "rf_dagdegrd.h" +#include "rf_map.h" /****************************************************************************** @@ -271,7 +272,7 @@ rf_CreateDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, int j, paramNum; RF_SectorCount_t sectorsPerSU; RF_ReconUnitNum_t which_ru; - char *overlappingPDAs;/* a temporary array of flags */ + char overlappingPDAs[RF_MAXCOL];/* a temporary array of flags */ RF_AccessStripeMapHeader_t *new_asm_h[2]; RF_PhysDiskAddr_t *pda, *parityPDA; RF_StripeNum_t parityStripeID; @@ -301,7 +302,7 @@ rf_CreateDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, */ /* overlappingPDAs array must be zero'd */ - RF_Malloc(overlappingPDAs, asmap->numStripeUnitsAccessed * sizeof(char), (char *)); + memset(overlappingPDAs, 0, RF_MAXCOL); rf_GenerateFailedAccessASMs(raidPtr, asmap, failedPDA, dag_h, new_asm_h, &nXorBufs, &rpBuf, overlappingPDAs, allocList); @@ -421,7 +422,9 @@ rf_CreateDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, } } /* make a PDA for the parity unit */ - RF_MallocAndAdd(parityPDA, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); + parityPDA = rf_AllocPhysDiskAddr(); + parityPDA->next = dag_h->pda_cleanup_list; + dag_h->pda_cleanup_list = parityPDA; parityPDA->col = asmap->parityInfo->col; parityPDA->startSector = ((asmap->parityInfo->startSector / sectorsPerSU) * sectorsPerSU) + (failedPDA->startSector % sectorsPerSU); @@ -452,15 +455,17 @@ rf_CreateDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* any Rud nodes that overlap the failed access need to be * xored in */ if (overlappingPDAs[i]) { - RF_MallocAndAdd(pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); + pda = rf_AllocPhysDiskAddr(); memcpy((char *) pda, (char *) tmprudNode->params[0].p, sizeof(RF_PhysDiskAddr_t)); + /* add it into the pda_cleanup_list *after* the copy, TYVM */ + pda->next = dag_h->pda_cleanup_list; + dag_h->pda_cleanup_list = pda; rf_RangeRestrictPDA(raidPtr, failedPDA, pda, RF_RESTRICT_DOBUFFER, 0); xorNode->params[paramNum++].p = pda; xorNode->params[paramNum++].p = pda->bufPtr; } tmprudNode = tmprudNode->list_next; } - RF_Free(overlappingPDAs, asmap->numStripeUnitsAccessed * sizeof(char)); /* install parity pda as last set of params to be xor'd */ xorNode->params[paramNum++].p = parityPDA; diff --git a/sys/dev/raidframe/rf_dagdegwr.c b/sys/dev/raidframe/rf_dagdegwr.c index a775b00ac5de..afb7f87108ec 100644 --- a/sys/dev/raidframe/rf_dagdegwr.c +++ b/sys/dev/raidframe/rf_dagdegwr.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagdegwr.c,v 1.18 2004/03/18 16:40:05 oster Exp $ */ +/* $NetBSD: rf_dagdegwr.c,v 1.19 2004/03/19 15:16:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.18 2004/03/18 16:40:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.19 2004/03/19 15:16:18 oster Exp $"); #include @@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.18 2004/03/18 16:40:05 oster Exp $ #include "rf_debugMem.h" #include "rf_general.h" #include "rf_dagdegwr.h" +#include "rf_map.h" /****************************************************************************** @@ -169,7 +170,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, RF_ReconUnitNum_t which_ru; char *xorTargetBuf = NULL; /* the target buffer for the XOR * operation */ - char *overlappingPDAs;/* a temporary array of flags */ + char overlappingPDAs[RF_MAXCOL];/* a temporary array of flags */ RF_AccessStripeMapHeader_t *new_asm_h[2]; RF_PhysDiskAddr_t *pda, *parityPDA; RF_StripeNum_t parityStripeID; @@ -197,7 +198,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, * we need in order to recover the lost data. */ /* overlappingPDAs array must be zero'd */ - RF_Malloc(overlappingPDAs, asmap->numStripeUnitsAccessed * sizeof(char), (char *)); + memset(overlappingPDAs, 0, RF_MAXCOL); rf_GenerateFailedAccessASMs(raidPtr, asmap, failedPDA, dag_h, new_asm_h, &nXorBufs, NULL, overlappingPDAs, allocList); @@ -358,7 +359,9 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, * asmap->parityInfo describes the failed unit and the copy can also * be avoided. */ - RF_MallocAndAdd(parityPDA, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); + parityPDA = rf_AllocPhysDiskAddr(); + parityPDA->next = dag_h->pda_cleanup_list; + dag_h->pda_cleanup_list = parityPDA; parityPDA->col = asmap->parityInfo->col; parityPDA->startSector = ((asmap->parityInfo->startSector / sectorsPerSU) * sectorsPerSU) + (failedPDA->startSector % sectorsPerSU); @@ -435,15 +438,17 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, /* any Wnd nodes that overlap the failed access need to be * xored in */ if (overlappingPDAs[i]) { - RF_MallocAndAdd(pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); + pda = rf_AllocPhysDiskAddr(); memcpy((char *) pda, (char *) tmpwndNode->params[0].p, sizeof(RF_PhysDiskAddr_t)); + /* add it into the pda_cleanup_list *after* the copy, TYVM */ + pda->next = dag_h->pda_cleanup_list; + dag_h->pda_cleanup_list = pda; rf_RangeRestrictPDA(raidPtr, failedPDA, pda, RF_RESTRICT_DOBUFFER, 0); xorNode->params[paramNum++].p = pda; xorNode->params[paramNum++].p = pda->bufPtr; } tmpwndNode = tmpwndNode->list_next; } - RF_Free(overlappingPDAs, asmap->numStripeUnitsAccessed * sizeof(char)); /* * Install the failed PDA into the xor param list so that the diff --git a/sys/dev/raidframe/rf_dagutils.c b/sys/dev/raidframe/rf_dagutils.c index 505aa29a1920..71b06e517859 100644 --- a/sys/dev/raidframe/rf_dagutils.c +++ b/sys/dev/raidframe/rf_dagutils.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagutils.c,v 1.38 2004/03/18 16:40:05 oster Exp $ */ +/* $NetBSD: rf_dagutils.c,v 1.39 2004/03/19 15:16:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ *****************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.38 2004/03/18 16:40:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.39 2004/03/19 15:16:18 oster Exp $"); #include @@ -155,6 +155,7 @@ void rf_FreeDAG(RF_DagHeader_t *dag_h) { RF_AccessStripeMapHeader_t *asmap, *t_asmap; + RF_PhysDiskAddr_t *pda; RF_DagNode_t *tmpnode; RF_DagHeader_t *nextDag; @@ -166,7 +167,12 @@ rf_FreeDAG(RF_DagHeader_t *dag_h) asmap = asmap->next; rf_FreeAccessStripeMap(t_asmap); } - while(dag_h->nodes) { + while (dag_h->pda_cleanup_list) { + pda = dag_h->pda_cleanup_list; + dag_h->pda_cleanup_list = dag_h->pda_cleanup_list->next; + rf_FreePhysDiskAddr(pda); + } + while (dag_h->nodes) { tmpnode = dag_h->nodes; dag_h->nodes = dag_h->nodes->list_next; rf_FreeDAGNode(tmpnode); diff --git a/sys/dev/raidframe/rf_map.c b/sys/dev/raidframe/rf_map.c index cbaa07c545bf..c40f557e632e 100644 --- a/sys/dev/raidframe/rf_map.c +++ b/sys/dev/raidframe/rf_map.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_map.c,v 1.35 2004/03/19 02:57:34 oster Exp $ */ +/* $NetBSD: rf_map.c,v 1.36 2004/03/19 15:16:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ **************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.35 2004/03/19 02:57:34 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.36 2004/03/19 15:16:18 oster Exp $"); #include @@ -471,13 +471,11 @@ rf_AllocPDAList(int count) return (p); } -#if RF_INCLUDE_PARITYLOGGING > 0 void rf_FreePhysDiskAddr(RF_PhysDiskAddr_t *p) { pool_put(&rf_pools.pda, p); } -#endif static void rf_FreePDAList(RF_PhysDiskAddr_t *pda_list)