Sync usage with man page.
[netbsd-mini2440.git] / sys / dev / raidframe / rf_evenodd_dags.c
blob06a2308caa639f91a54897e92c162a7d834d2541
1 /* $NetBSD: rf_evenodd_dags.c,v 1.3 2001/10/04 15:58:53 oster Exp $ */
2 /*
3 * rf_evenodd_dags.c
4 */
5 /*
6 * Copyright (c) 1996 Carnegie-Mellon University.
7 * All rights reserved.
9 * Author: Chang-Ming Wu
11 * Permission to use, copy, modify and distribute this software and
12 * its documentation is hereby granted, provided that both the copyright
13 * notice and this permission notice appear in all copies of the
14 * software, derivative works or modified versions, and any portions
15 * thereof, and that both notices appear in supporting documentation.
17 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
18 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
19 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
21 * Carnegie Mellon requests users of this software to return to
23 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
24 * School of Computer Science
25 * Carnegie Mellon University
26 * Pittsburgh PA 15213-3890
28 * any improvements or extensions that they make and grant Carnegie the
29 * rights to redistribute these changes.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD$");
35 #include "rf_archs.h"
37 #if RF_INCLUDE_EVENODD > 0
39 #include <dev/raidframe/raidframevar.h>
41 #include "rf_raid.h"
42 #include "rf_dag.h"
43 #include "rf_dagfuncs.h"
44 #include "rf_dagutils.h"
45 #include "rf_etimer.h"
46 #include "rf_acctrace.h"
47 #include "rf_general.h"
48 #include "rf_evenodd_dags.h"
49 #include "rf_evenodd.h"
50 #include "rf_evenodd_dagfuncs.h"
51 #include "rf_pq.h"
52 #include "rf_dagdegrd.h"
53 #include "rf_dagdegwr.h"
54 #include "rf_dagffwr.h"
58 * Lost one data.
59 * Use P to reconstruct missing data.
61 RF_CREATE_DAG_FUNC_DECL(rf_EO_100_CreateReadDAG)
63 rf_CreateDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_eoPRecoveryFuncs);
66 * Lost data + E.
67 * Use P to reconstruct missing data.
69 RF_CREATE_DAG_FUNC_DECL(rf_EO_101_CreateReadDAG)
71 rf_CreateDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_eoPRecoveryFuncs);
74 * Lost data + P.
75 * Make E look like P, and use Eor for Xor, and we can
76 * use degraded read DAG.
78 RF_CREATE_DAG_FUNC_DECL(rf_EO_110_CreateReadDAG)
80 RF_PhysDiskAddr_t *temp;
81 /* swap P and E pointers to fake out the DegradedReadDAG code */
82 temp = asmap->parityInfo;
83 asmap->parityInfo = asmap->qInfo;
84 asmap->qInfo = temp;
85 rf_CreateDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_eoERecoveryFuncs);
88 * Lost two data.
90 RF_CREATE_DAG_FUNC_DECL(rf_EOCreateDoubleDegradedReadDAG)
92 rf_EO_DoubleDegRead(raidPtr, asmap, dag_h, bp, flags, allocList);
95 * Lost two data.
97 RF_CREATE_DAG_FUNC_DECL(rf_EO_200_CreateReadDAG)
99 rf_EOCreateDoubleDegradedReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList);
101 RF_CREATE_DAG_FUNC_DECL(rf_EO_100_CreateWriteDAG)
103 if (asmap->numStripeUnitsAccessed != 1 &&
104 asmap->failedPDAs[0]->numSector != raidPtr->Layout.sectorsPerStripeUnit)
105 RF_PANIC();
106 rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 2, (int (*) (RF_DagNode_t *)) rf_Degraded_100_EOFunc, RF_TRUE);
109 * E is dead. Small write.
111 RF_CREATE_DAG_FUNC_DECL(rf_EO_001_CreateSmallWriteDAG)
113 rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_EOSmallWritePFuncs, NULL);
116 * E is dead. Large write.
118 RF_CREATE_DAG_FUNC_DECL(rf_EO_001_CreateLargeWriteDAG)
120 rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularPFunc, RF_TRUE);
123 * P is dead. Small write.
124 * Swap E + P, use single-degraded stuff.
126 RF_CREATE_DAG_FUNC_DECL(rf_EO_010_CreateSmallWriteDAG)
128 RF_PhysDiskAddr_t *temp;
129 /* swap P and E pointers to fake out the DegradedReadDAG code */
130 temp = asmap->parityInfo;
131 asmap->parityInfo = asmap->qInfo;
132 asmap->qInfo = temp;
133 rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_EOSmallWriteEFuncs, NULL);
136 * P is dead. Large write.
137 * Swap E + P, use single-degraded stuff.
139 RF_CREATE_DAG_FUNC_DECL(rf_EO_010_CreateLargeWriteDAG)
141 RF_PhysDiskAddr_t *temp;
142 /* swap P and E pointers to fake out the code */
143 temp = asmap->parityInfo;
144 asmap->parityInfo = asmap->qInfo;
145 asmap->qInfo = temp;
146 rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularEFunc, RF_FALSE);
148 RF_CREATE_DAG_FUNC_DECL(rf_EO_011_CreateWriteDAG)
150 rf_CreateNonRedundantWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
151 RF_IO_TYPE_WRITE);
153 RF_CREATE_DAG_FUNC_DECL(rf_EO_110_CreateWriteDAG)
155 RF_PhysDiskAddr_t *temp;
157 if (asmap->numStripeUnitsAccessed != 1 &&
158 asmap->failedPDAs[0]->numSector != raidPtr->Layout.sectorsPerStripeUnit) {
159 RF_PANIC();
161 /* swap P and E to fake out parity code */
162 temp = asmap->parityInfo;
163 asmap->parityInfo = asmap->qInfo;
164 asmap->qInfo = temp;
165 rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, (int (*) (RF_DagNode_t *)) rf_EO_DegradedWriteEFunc, RF_FALSE);
166 /* is the regular E func the right one to call? */
168 RF_CREATE_DAG_FUNC_DECL(rf_EO_101_CreateWriteDAG)
170 if (asmap->numStripeUnitsAccessed != 1 &&
171 asmap->failedPDAs[0]->numSector != raidPtr->Layout.sectorsPerStripeUnit)
172 RF_PANIC();
173 rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RecoveryXorFunc, RF_TRUE);
175 RF_CREATE_DAG_FUNC_DECL(rf_EO_DoubleDegRead)
177 rf_DoubleDegRead(raidPtr, asmap, dag_h, bp, flags, allocList,
178 "Re", "EvenOddRecovery", rf_EvenOddDoubleRecoveryFunc);
180 RF_CREATE_DAG_FUNC_DECL(rf_EOCreateSmallWriteDAG)
182 rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_pFuncs, &rf_EOSmallWriteEFuncs);
184 RF_CREATE_DAG_FUNC_DECL(rf_EOCreateLargeWriteDAG)
186 rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 2, rf_RegularPEFunc, RF_FALSE);
188 RF_CREATE_DAG_FUNC_DECL(rf_EO_200_CreateWriteDAG)
190 rf_DoubleDegSmallWrite(raidPtr, asmap, dag_h, bp, flags, allocList, "Re", "We", "EOWrDDRecovery", rf_EOWriteDoubleRecoveryFunc);
192 #endif /* RF_INCLUDE_EVENODD > 0 */