Make these compile with RF_INCLUDE_RAID6.

This commit is contained in:
oster 1999-08-15 02:36:40 +00:00
parent ff6d7dd494
commit d516e7b571
3 changed files with 54 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_pq.c,v 1.4 1999/08/13 03:41:57 oster Exp $ */
/* $NetBSD: rf_pq.c,v 1.5 1999/08/15 02:36:40 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -116,7 +116,7 @@ rf_PQDagSelect(
switch (ndfail) {
case 0:
/* fault free read */
*createFunc = rf_CreateFaultFreeReadDAG; /* same as raid 5 */
*createFunc = (RF_VoidFuncPtr) rf_CreateFaultFreeReadDAG; /* same as raid 5 */
break;
case 1:
/* lost a single data unit */
@ -125,22 +125,22 @@ rf_PQDagSelect(
* reconstruct read using "q". */
if (ntfail == 2) { /* also lost redundancy */
if (asmap->failedPDAs[1]->type == RF_PDA_TYPE_PARITY)
*createFunc = rf_PQ_110_CreateReadDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_110_CreateReadDAG;
else
*createFunc = rf_PQ_101_CreateReadDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_101_CreateReadDAG;
} else {
/* P and Q are ok. But is there a failure in
* some unaccessed data unit? */
if (rf_NumFailedDataUnitsInStripe(raidPtr, asmap) == 2)
*createFunc = rf_PQ_200_CreateReadDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_200_CreateReadDAG;
else
*createFunc = rf_PQ_100_CreateReadDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_100_CreateReadDAG;
}
break;
case 2:
/* lost two data units */
/* *infoFunc = PQOneTwo; */
*createFunc = rf_PQ_200_CreateReadDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_200_CreateReadDAG;
break;
}
return;
@ -152,9 +152,9 @@ rf_PQDagSelect(
(((asmap->numStripeUnitsAccessed <= (layoutPtr->numDataCol / 2)) && (layoutPtr->numDataCol != 1)) ||
(asmap->parityInfo->next != NULL) || (asmap->qInfo->next != NULL) || rf_CheckStripeForFailures(raidPtr, asmap))) {
*createFunc = rf_PQCreateSmallWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQCreateSmallWriteDAG;
} else {
*createFunc = rf_PQCreateLargeWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQCreateLargeWriteDAG;
}
break;
@ -166,41 +166,41 @@ rf_PQDagSelect(
* write. */
if (((asmap->numStripeUnitsAccessed <= (layoutPtr->numDataCol / 2)) || (asmap->numStripeUnitsAccessed == 1))
|| rf_NumFailedDataUnitsInStripe(raidPtr, asmap))
*createFunc = rf_PQ_001_CreateSmallWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_001_CreateSmallWriteDAG;
else
*createFunc = rf_PQ_001_CreateLargeWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_001_CreateLargeWriteDAG;
} else {/* parity died, small write only updating Q */
if (((asmap->numStripeUnitsAccessed <= (layoutPtr->numDataCol / 2)) || (asmap->numStripeUnitsAccessed == 1))
|| rf_NumFailedDataUnitsInStripe(raidPtr, asmap))
*createFunc = rf_PQ_010_CreateSmallWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_010_CreateSmallWriteDAG;
else
*createFunc = rf_PQ_010_CreateLargeWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_010_CreateLargeWriteDAG;
}
} else { /* data missing. Do a P reconstruct write if
* only a single data unit is lost in the
* stripe, otherwise a PQ reconstruct write. */
if (rf_NumFailedDataUnitsInStripe(raidPtr, asmap) == 2)
*createFunc = rf_PQ_200_CreateWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_200_CreateWriteDAG;
else
*createFunc = rf_PQ_100_CreateWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_100_CreateWriteDAG;
}
break;
case 2: /* two disk faults */
switch (npfail) {
case 2: /* both p and q dead */
*createFunc = rf_PQ_011_CreateWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_011_CreateWriteDAG;
break;
case 1: /* either p or q and dead data */
RF_ASSERT(asmap->failedPDAs[0]->type == RF_PDA_TYPE_DATA);
RF_ASSERT((asmap->failedPDAs[1]->type == RF_PDA_TYPE_PARITY) || (asmap->failedPDAs[1]->type == RF_PDA_TYPE_Q));
if (asmap->failedPDAs[1]->type == RF_PDA_TYPE_Q)
*createFunc = rf_PQ_101_CreateWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_101_CreateWriteDAG;
else
*createFunc = rf_PQ_110_CreateWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_110_CreateWriteDAG;
break;
case 0: /* double data loss */
*createFunc = rf_PQ_200_CreateWriteDAG;
*createFunc = (RF_VoidFuncPtr) rf_PQ_200_CreateWriteDAG;
break;
}
break;
@ -214,6 +214,7 @@ rf_PQDagSelect(
/*
Used as a stop gap info function
*/
#if 0
static void
PQOne(raidPtr, nSucc, nAnte, asmap)
RF_Raid_t *raidPtr;
@ -234,6 +235,8 @@ PQOneTwo(raidPtr, nSucc, nAnte, asmap)
*nSucc = 1;
*nAnte = 2;
}
#endif
RF_CREATE_DAG_FUNC_DECL(rf_PQCreateLargeWriteDAG)
{
rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 2,
@ -353,6 +356,8 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQCreateSmallWriteDAG)
rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_pFuncs, &rf_qFuncs);
}
static void RegularQSubr(RF_DagNode_t *node, char *qbuf);
static void
RegularQSubr(node, qbuf)
RF_DagNode_t *node;
@ -395,6 +400,8 @@ RegularQSubr(node, qbuf)
used in degraded writes.
*/
static void DegrQSubr(RF_DagNode_t *node);
static void
DegrQSubr(node)
RF_DagNode_t *node;
@ -737,7 +744,10 @@ QDelta(
unsigned long a, d, new;
unsigned long a1, a2;
unsigned int *q = &(rf_qfor[28 - coeff][0]);
unsigned r = rf_rn[coeff + 1];
unsigned int r = rf_rn[coeff + 1];
r = a1 = a2 = new = d = a = 0; /* XXX for now... */
q = NULL; /* XXX for now */
#ifdef _KERNEL
/* PQ in kernel currently not supported because the encoding/decoding

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_pqdeg.c,v 1.3 1999/02/05 00:06:15 oster Exp $ */
/* $NetBSD: rf_pqdeg.c,v 1.4 1999/08/15 02:36:40 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -103,23 +103,29 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_110_CreateReadDAG)
both P and Q to reconstruct the data. Note that only
one data unit we are reading may actually be missing.
*/
RF_CREATE_DAG_FUNC_DECL(rf_CreateDoubleDegradedReadDAG);
RF_CREATE_DAG_FUNC_DECL(rf_CreateDoubleDegradedReadDAG)
{
rf_PQ_DoubleDegRead(raidPtr, asmap, dag_h, bp, flags, allocList);
}
RF_CREATE_DAG_FUNC_DECL(rf_PQ_200_CreateReadDAG);
RF_CREATE_DAG_FUNC_DECL(rf_PQ_200_CreateReadDAG)
{
rf_CreateDoubleDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList);
}
/* Writes, single failure */
RF_CREATE_DAG_FUNC_DECL(rf_PQ_100_CreateWriteDAG);
RF_CREATE_DAG_FUNC_DECL(rf_PQ_100_CreateWriteDAG)
{
if (asmap->numStripeUnitsAccessed != 1 &&
asmap->failedPDAs[0]->numSector != raidPtr->Layout.sectorsPerStripeUnit)
asmap->failedPDAs[0]->numSector !=
raidPtr->Layout.sectorsPerStripeUnit)
RF_PANIC();
rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags,
allocList, 2, (int (*) ()) rf_Degraded_100_PQFunc, RF_FALSE);
rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp,
flags, allocList, 2,
(int (*) (RF_DagNode_t *)) rf_Degraded_100_PQFunc,
RF_FALSE);
}
/* Dead P - act like a RAID 5 small write with parity = Q */
RF_CREATE_DAG_FUNC_DECL(rf_PQ_010_CreateSmallWriteDAG)
@ -129,12 +135,14 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_010_CreateSmallWriteDAG)
temp = asmap->parityInfo;
asmap->parityInfo = asmap->qInfo;
asmap->qInfo = temp;
rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_qFuncs, NULL);
rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags,
allocList, &rf_qFuncs, NULL);
}
/* Dead Q - act like a RAID 5 small write */
RF_CREATE_DAG_FUNC_DECL(rf_PQ_001_CreateSmallWriteDAG)
{
rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_pFuncs, NULL);
rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags,
allocList, &rf_pFuncs, NULL);
}
/* Dead P - act like a RAID 5 large write but for Q */
RF_CREATE_DAG_FUNC_DECL(rf_PQ_010_CreateLargeWriteDAG)
@ -144,12 +152,14 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_010_CreateLargeWriteDAG)
temp = asmap->parityInfo;
asmap->parityInfo = asmap->qInfo;
asmap->qInfo = temp;
rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularQFunc, RF_FALSE);
rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags,
allocList, 1, rf_RegularQFunc, RF_FALSE);
}
/* Dead Q - act like a RAID 5 large write */
RF_CREATE_DAG_FUNC_DECL(rf_PQ_001_CreateLargeWriteDAG)
{
rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularPFunc, RF_FALSE);
rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags,
allocList, 1, rf_RegularPFunc, RF_FALSE);
}
@ -187,7 +197,9 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_110_CreateWriteDAG)
asmap->parityInfo = asmap->qInfo;
asmap->qInfo = temp;
rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags,
allocList, 1, (int (*) ()) rf_PQ_DegradedWriteQFunc, RF_FALSE);
allocList, 1,
(int (*) (RF_DagNode_t *)) rf_PQ_DegradedWriteQFunc,
RF_FALSE);
/* is the regular Q func the right one to call? */
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_pqdegdags.c,v 1.4 1999/08/13 03:41:57 oster Exp $ */
/* $NetBSD: rf_pqdegdags.c,v 1.5 1999/08/15 02:36:40 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -39,6 +39,8 @@
#include "rf_types.h"
#include "rf_raid.h"
#include "rf_dag.h"
#include "rf_dagdegrd.h"
#include "rf_dagdegwr.h"
#include "rf_dagfuncs.h"
#include "rf_dagutils.h"
#include "rf_etimer.h"