root/dev/raidframe/rf_evenodd_dags.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. RF_CREATE_DAG_FUNC_DECL
  2. RF_CREATE_DAG_FUNC_DECL
  3. RF_CREATE_DAG_FUNC_DECL
  4. RF_CREATE_DAG_FUNC_DECL
  5. RF_CREATE_DAG_FUNC_DECL
  6. RF_CREATE_DAG_FUNC_DECL
  7. RF_CREATE_DAG_FUNC_DECL
  8. RF_CREATE_DAG_FUNC_DECL
  9. RF_CREATE_DAG_FUNC_DECL
  10. RF_CREATE_DAG_FUNC_DECL
  11. RF_CREATE_DAG_FUNC_DECL
  12. RF_CREATE_DAG_FUNC_DECL
  13. RF_CREATE_DAG_FUNC_DECL
  14. RF_CREATE_DAG_FUNC_DECL
  15. RF_CREATE_DAG_FUNC_DECL
  16. RF_CREATE_DAG_FUNC_DECL
  17. RF_CREATE_DAG_FUNC_DECL

    1 /*      $OpenBSD: rf_evenodd_dags.c,v 1.3 2002/12/16 07:01:04 tdeval Exp $      */
    2 /*      $NetBSD: rf_evenodd_dags.c,v 1.2 1999/02/05 00:06:11 oster Exp $        */
    3 
    4 /*
    5  * rf_evenodd_dags.c
    6  */
    7 /*
    8  * Copyright (c) 1996 Carnegie-Mellon University.
    9  * All rights reserved.
   10  *
   11  * Author: Chang-Ming Wu
   12  *
   13  * Permission to use, copy, modify and distribute this software and
   14  * its documentation is hereby granted, provided that both the copyright
   15  * notice and this permission notice appear in all copies of the
   16  * software, derivative works or modified versions, and any portions
   17  * thereof, and that both notices appear in supporting documentation.
   18  *
   19  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   20  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
   21  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   22  *
   23  * Carnegie Mellon requests users of this software to return to
   24  *
   25  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   26  *  School of Computer Science
   27  *  Carnegie Mellon University
   28  *  Pittsburgh PA 15213-3890
   29  *
   30  * any improvements or extensions that they make and grant Carnegie the
   31  * rights to redistribute these changes.
   32  */
   33 
   34 #include "rf_archs.h"
   35 
   36 #if     RF_INCLUDE_EVENODD > 0
   37 
   38 #include "rf_types.h"
   39 #include "rf_raid.h"
   40 #include "rf_dag.h"
   41 #include "rf_dagfuncs.h"
   42 #include "rf_dagutils.h"
   43 #include "rf_etimer.h"
   44 #include "rf_acctrace.h"
   45 #include "rf_general.h"
   46 #include "rf_evenodd_dags.h"
   47 #include "rf_evenodd.h"
   48 #include "rf_evenodd_dagfuncs.h"
   49 #include "rf_pq.h"
   50 #include "rf_dagdegrd.h"
   51 #include "rf_dagdegwr.h"
   52 #include "rf_dagffwr.h"
   53 
   54 
   55 /*
   56  * Lost one data.
   57  * Use P to reconstruct missing data.
   58  */
   59 RF_CREATE_DAG_FUNC_DECL(rf_EO_100_CreateReadDAG)
   60 {
   61         rf_CreateDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
   62             &rf_eoPRecoveryFuncs);
   63 }
   64 
   65 /*
   66  * Lost data + E.
   67  * Use P to reconstruct missing data.
   68  */
   69 RF_CREATE_DAG_FUNC_DECL(rf_EO_101_CreateReadDAG)
   70 {
   71         rf_CreateDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
   72             &rf_eoPRecoveryFuncs);
   73 }
   74 
   75 /*
   76  * Lost data + P.
   77  * Make E look like P, and use Eor for Xor, and we can
   78  * use degraded read DAG.
   79  */
   80 RF_CREATE_DAG_FUNC_DECL(rf_EO_110_CreateReadDAG)
   81 {
   82         RF_PhysDiskAddr_t *temp;
   83         /* Swap P and E pointers to fake out the DegradedReadDAG code. */
   84         temp = asmap->parityInfo;
   85         asmap->parityInfo = asmap->qInfo;
   86         asmap->qInfo = temp;
   87         rf_CreateDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
   88             &rf_eoERecoveryFuncs);
   89 }
   90 
   91 /*
   92  * Lost two data.
   93  */
   94 RF_CREATE_DAG_FUNC_DECL(rf_EOCreateDoubleDegradedReadDAG)
   95 {
   96         rf_EO_DoubleDegRead(raidPtr, asmap, dag_h, bp, flags, allocList);
   97 }
   98 
   99 /*
  100  * Lost two data.
  101  */
  102 RF_CREATE_DAG_FUNC_DECL(rf_EO_200_CreateReadDAG)
  103 {
  104         rf_EOCreateDoubleDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags,
  105             allocList);
  106 }
  107 
  108 RF_CREATE_DAG_FUNC_DECL(rf_EO_100_CreateWriteDAG)
  109 {
  110         if (asmap->numStripeUnitsAccessed != 1 &&
  111             asmap->failedPDAs[0]->numSector !=
  112             raidPtr->Layout.sectorsPerStripeUnit)
  113                 RF_PANIC();
  114         rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp,
  115             flags, allocList, 2,
  116             (int (*) (RF_DagNode_t *)) rf_Degraded_100_EOFunc, RF_TRUE);
  117 }
  118 
  119 /*
  120  * E is dead. Small write.
  121  */
  122 RF_CREATE_DAG_FUNC_DECL(rf_EO_001_CreateSmallWriteDAG)
  123 {
  124         rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  125             allocList, &rf_EOSmallWritePFuncs, NULL);
  126 }
  127 
  128 /*
  129  * E is dead. Large write.
  130  */
  131 RF_CREATE_DAG_FUNC_DECL(rf_EO_001_CreateLargeWriteDAG)
  132 {
  133         rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  134             allocList, 1, rf_RegularPFunc, RF_TRUE);
  135 }
  136 
  137 /*
  138  * P is dead. Small write.
  139  * Swap E + P, use single-degraded stuff.
  140  */
  141 RF_CREATE_DAG_FUNC_DECL(rf_EO_010_CreateSmallWriteDAG)
  142 {
  143         RF_PhysDiskAddr_t *temp;
  144         /* Swap P and E pointers to fake out the DegradedReadDAG code. */
  145         temp = asmap->parityInfo;
  146         asmap->parityInfo = asmap->qInfo;
  147         asmap->qInfo = temp;
  148         rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  149             allocList, &rf_EOSmallWriteEFuncs, NULL);
  150 }
  151 
  152 /*
  153  * P is dead. Large write.
  154  * Swap E + P, use single-degraded stuff.
  155  */
  156 RF_CREATE_DAG_FUNC_DECL(rf_EO_010_CreateLargeWriteDAG)
  157 {
  158         RF_PhysDiskAddr_t *temp;
  159         /* Swap P and E pointers to fake out the code. */
  160         temp = asmap->parityInfo;
  161         asmap->parityInfo = asmap->qInfo;
  162         asmap->qInfo = temp;
  163         rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  164             allocList, 1, rf_RegularEFunc, RF_FALSE);
  165 }
  166 
  167 RF_CREATE_DAG_FUNC_DECL(rf_EO_011_CreateWriteDAG)
  168 {
  169         rf_CreateNonRedundantWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  170             allocList, RF_IO_TYPE_WRITE);
  171 }
  172 
  173 RF_CREATE_DAG_FUNC_DECL(rf_EO_110_CreateWriteDAG)
  174 {
  175         RF_PhysDiskAddr_t *temp;
  176 
  177         if (asmap->numStripeUnitsAccessed != 1 &&
  178             asmap->failedPDAs[0]->numSector !=
  179             raidPtr->Layout.sectorsPerStripeUnit) {
  180                 RF_PANIC();
  181         }
  182         /* Swap P and E to fake out parity code. */
  183         temp = asmap->parityInfo;
  184         asmap->parityInfo = asmap->qInfo;
  185         asmap->qInfo = temp;
  186         rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp,
  187             flags, allocList, 1,
  188             (int (*) (RF_DagNode_t *)) rf_EO_DegradedWriteEFunc, RF_FALSE);
  189         /* Is the regular E func the right one to call ? */
  190 }
  191 
  192 RF_CREATE_DAG_FUNC_DECL(rf_EO_101_CreateWriteDAG)
  193 {
  194         if (asmap->numStripeUnitsAccessed != 1 &&
  195             asmap->failedPDAs[0]->numSector !=
  196             raidPtr->Layout.sectorsPerStripeUnit)
  197                 RF_PANIC();
  198         rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp,
  199             flags, allocList, 1, rf_RecoveryXorFunc, RF_TRUE);
  200 }
  201 
  202 RF_CREATE_DAG_FUNC_DECL(rf_EO_DoubleDegRead)
  203 {
  204         rf_DoubleDegRead(raidPtr, asmap, dag_h, bp, flags, allocList,
  205             "Re", "EvenOddRecovery", rf_EvenOddDoubleRecoveryFunc);
  206 }
  207 
  208 RF_CREATE_DAG_FUNC_DECL(rf_EOCreateSmallWriteDAG)
  209 {
  210         rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  211             allocList, &rf_pFuncs, &rf_EOSmallWriteEFuncs);
  212 }
  213 
  214 RF_CREATE_DAG_FUNC_DECL(rf_EOCreateLargeWriteDAG)
  215 {
  216         rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags,
  217             allocList, 2, rf_RegularPEFunc, RF_FALSE);
  218 }
  219 
  220 RF_CREATE_DAG_FUNC_DECL(rf_EO_200_CreateWriteDAG)
  221 {
  222         rf_DoubleDegSmallWrite(raidPtr, asmap, dag_h, bp, flags, allocList,
  223             "Re", "We", "EOWrDDRecovery", rf_EOWriteDoubleRecoveryFunc);
  224 }
  225 
  226 #endif  /* RF_INCLUDE_EVENODD > 0 */

/* [<][>][^][v][top][bottom][index][help] */