rf_dagffrd.c revision 1.1 1 1.1 oster /* $NetBSD: rf_dagffrd.c,v 1.1 1998/11/13 04:20:27 oster Exp $ */
2 1.1 oster /*
3 1.1 oster * Copyright (c) 1995 Carnegie-Mellon University.
4 1.1 oster * All rights reserved.
5 1.1 oster *
6 1.1 oster * Author: Mark Holland, Daniel Stodolsky, William V. Courtright II
7 1.1 oster *
8 1.1 oster * Permission to use, copy, modify and distribute this software and
9 1.1 oster * its documentation is hereby granted, provided that both the copyright
10 1.1 oster * notice and this permission notice appear in all copies of the
11 1.1 oster * software, derivative works or modified versions, and any portions
12 1.1 oster * thereof, and that both notices appear in supporting documentation.
13 1.1 oster *
14 1.1 oster * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 1.1 oster * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
16 1.1 oster * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 1.1 oster *
18 1.1 oster * Carnegie Mellon requests users of this software to return to
19 1.1 oster *
20 1.1 oster * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
21 1.1 oster * School of Computer Science
22 1.1 oster * Carnegie Mellon University
23 1.1 oster * Pittsburgh PA 15213-3890
24 1.1 oster *
25 1.1 oster * any improvements or extensions that they make and grant Carnegie the
26 1.1 oster * rights to redistribute these changes.
27 1.1 oster */
28 1.1 oster
29 1.1 oster /*
30 1.1 oster * rf_dagffrd.c
31 1.1 oster *
32 1.1 oster * code for creating fault-free read DAGs
33 1.1 oster *
34 1.1 oster * :
35 1.1 oster * Log: rf_dagffrd.c,v
36 1.1 oster * Revision 1.14 1996/07/28 20:31:39 jimz
37 1.1 oster * i386netbsd port
38 1.1 oster * true/false fixup
39 1.1 oster *
40 1.1 oster * Revision 1.13 1996/07/22 19:52:16 jimz
41 1.1 oster * switched node params to RF_DagParam_t, a union of
42 1.1 oster * a 64-bit int and a void *, for better portability
43 1.1 oster * attempted hpux port, but failed partway through for
44 1.1 oster * lack of a single C compiler capable of compiling all
45 1.1 oster * source files
46 1.1 oster *
47 1.1 oster * Revision 1.12 1996/06/09 02:36:46 jimz
48 1.1 oster * lots of little crufty cleanup- fixup whitespace
49 1.1 oster * issues, comment #ifdefs, improve typing in some
50 1.1 oster * places (esp size-related)
51 1.1 oster *
52 1.1 oster * Revision 1.11 1996/06/06 17:30:44 jimz
53 1.1 oster * turn old Raid1 mirror read creation into a more generic function
54 1.1 oster * parameterized by an addtional parameter: type of mirrored read
55 1.1 oster * this is now used by other dag creation routines so chained declustering
56 1.1 oster * and raid1 can share dag creation code, but have different mirroring
57 1.1 oster * policies
58 1.1 oster *
59 1.1 oster * Revision 1.10 1996/05/31 22:26:54 jimz
60 1.1 oster * fix a lot of mapping problems, memory allocation problems
61 1.1 oster * found some weird lock issues, fixed 'em
62 1.1 oster * more code cleanup
63 1.1 oster *
64 1.1 oster * Revision 1.9 1996/05/30 11:29:41 jimz
65 1.1 oster * Numerous bug fixes. Stripe lock release code disagreed with the taking code
66 1.1 oster * about when stripes should be locked (I made it consistent: no parity, no lock)
67 1.1 oster * There was a lot of extra serialization of I/Os which I've removed- a lot of
68 1.1 oster * it was to calculate values for the cache code, which is no longer with us.
69 1.1 oster * More types, function, macro cleanup. Added code to properly quiesce the array
70 1.1 oster * on shutdown. Made a lot of stuff array-specific which was (bogusly) general
71 1.1 oster * before. Fixed memory allocation, freeing bugs.
72 1.1 oster *
73 1.1 oster * Revision 1.8 1996/05/27 18:56:37 jimz
74 1.1 oster * more code cleanup
75 1.1 oster * better typing
76 1.1 oster * compiles in all 3 environments
77 1.1 oster *
78 1.1 oster * Revision 1.7 1996/05/24 22:17:04 jimz
79 1.1 oster * continue code + namespace cleanup
80 1.1 oster * typed a bunch of flags
81 1.1 oster *
82 1.1 oster * Revision 1.6 1996/05/24 04:28:55 jimz
83 1.1 oster * release cleanup ckpt
84 1.1 oster *
85 1.1 oster * Revision 1.5 1996/05/23 21:46:35 jimz
86 1.1 oster * checkpoint in code cleanup (release prep)
87 1.1 oster * lots of types, function names have been fixed
88 1.1 oster *
89 1.1 oster * Revision 1.4 1996/05/23 00:33:23 jimz
90 1.1 oster * code cleanup: move all debug decls to rf_options.c, all extern
91 1.1 oster * debug decls to rf_options.h, all debug vars preceded by rf_
92 1.1 oster *
93 1.1 oster * Revision 1.3 1996/05/18 19:51:34 jimz
94 1.1 oster * major code cleanup- fix syntax, make some types consistent,
95 1.1 oster * add prototypes, clean out dead code, et cetera
96 1.1 oster *
97 1.1 oster * Revision 1.2 1996/05/08 21:01:24 jimz
98 1.1 oster * fixed up enum type names that were conflicting with other
99 1.1 oster * enums and function names (ie, "panic")
100 1.1 oster * future naming trends will be towards RF_ and rf_ for
101 1.1 oster * everything raidframe-related
102 1.1 oster *
103 1.1 oster * Revision 1.1 1996/05/03 19:19:20 wvcii
104 1.1 oster * Initial revision
105 1.1 oster *
106 1.1 oster */
107 1.1 oster
108 1.1 oster #include "rf_types.h"
109 1.1 oster #include "rf_raid.h"
110 1.1 oster #include "rf_dag.h"
111 1.1 oster #include "rf_dagutils.h"
112 1.1 oster #include "rf_dagfuncs.h"
113 1.1 oster #include "rf_threadid.h"
114 1.1 oster #include "rf_debugMem.h"
115 1.1 oster #include "rf_memchunk.h"
116 1.1 oster #include "rf_general.h"
117 1.1 oster #include "rf_dagffrd.h"
118 1.1 oster
119 1.1 oster /******************************************************************************
120 1.1 oster *
121 1.1 oster * General comments on DAG creation:
122 1.1 oster *
123 1.1 oster * All DAGs in this file use roll-away error recovery. Each DAG has a single
124 1.1 oster * commit node, usually called "Cmt." If an error occurs before the Cmt node
125 1.1 oster * is reached, the execution engine will halt forward execution and work
126 1.1 oster * backward through the graph, executing the undo functions. Assuming that
127 1.1 oster * each node in the graph prior to the Cmt node are undoable and atomic - or -
128 1.1 oster * does not make changes to permanent state, the graph will fail atomically.
129 1.1 oster * If an error occurs after the Cmt node executes, the engine will roll-forward
130 1.1 oster * through the graph, blindly executing nodes until it reaches the end.
131 1.1 oster * If a graph reaches the end, it is assumed to have completed successfully.
132 1.1 oster *
133 1.1 oster * A graph has only 1 Cmt node.
134 1.1 oster *
135 1.1 oster */
136 1.1 oster
137 1.1 oster
138 1.1 oster /******************************************************************************
139 1.1 oster *
140 1.1 oster * The following wrappers map the standard DAG creation interface to the
141 1.1 oster * DAG creation routines. Additionally, these wrappers enable experimentation
142 1.1 oster * with new DAG structures by providing an extra level of indirection, allowing
143 1.1 oster * the DAG creation routines to be replaced at this single point.
144 1.1 oster */
145 1.1 oster
146 1.1 oster void rf_CreateFaultFreeReadDAG(
147 1.1 oster RF_Raid_t *raidPtr,
148 1.1 oster RF_AccessStripeMap_t *asmap,
149 1.1 oster RF_DagHeader_t *dag_h,
150 1.1 oster void *bp,
151 1.1 oster RF_RaidAccessFlags_t flags,
152 1.1 oster RF_AllocListElem_t *allocList)
153 1.1 oster {
154 1.1 oster rf_CreateNonredundantDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
155 1.1 oster RF_IO_TYPE_READ);
156 1.1 oster }
157 1.1 oster
158 1.1 oster
159 1.1 oster /******************************************************************************
160 1.1 oster *
161 1.1 oster * DAG creation code begins here
162 1.1 oster */
163 1.1 oster
164 1.1 oster /******************************************************************************
165 1.1 oster *
166 1.1 oster * creates a DAG to perform a nonredundant read or write of data within one
167 1.1 oster * stripe.
168 1.1 oster * For reads, this DAG is as follows:
169 1.1 oster *
170 1.1 oster * /---- read ----\
171 1.1 oster * Header -- Block ---- read ---- Commit -- Terminate
172 1.1 oster * \---- read ----/
173 1.1 oster *
174 1.1 oster * For writes, this DAG is as follows:
175 1.1 oster *
176 1.1 oster * /---- write ----\
177 1.1 oster * Header -- Commit ---- write ---- Block -- Terminate
178 1.1 oster * \---- write ----/
179 1.1 oster *
180 1.1 oster * There is one disk node per stripe unit accessed, and all disk nodes are in
181 1.1 oster * parallel.
182 1.1 oster *
183 1.1 oster * Tricky point here: The first disk node (read or write) is created
184 1.1 oster * normally. Subsequent disk nodes are created by copying the first one,
185 1.1 oster * and modifying a few params. The "succedents" and "antecedents" fields are
186 1.1 oster * _not_ re-created in each node, but rather left pointing to the same array
187 1.1 oster * that was malloc'd when the first node was created. Thus, it's essential
188 1.1 oster * that when this DAG is freed, the succedents and antecedents fields be freed
189 1.1 oster * in ONLY ONE of the read nodes. This does not apply to the "params" field
190 1.1 oster * because it is recreated for each READ node.
191 1.1 oster *
192 1.1 oster * Note that normal-priority accesses do not need to be tagged with their
193 1.1 oster * parity stripe ID, because they will never be promoted. Hence, I've
194 1.1 oster * commented-out the code to do this, and marked it with UNNEEDED.
195 1.1 oster *
196 1.1 oster *****************************************************************************/
197 1.1 oster
198 1.1 oster void rf_CreateNonredundantDAG(
199 1.1 oster RF_Raid_t *raidPtr,
200 1.1 oster RF_AccessStripeMap_t *asmap,
201 1.1 oster RF_DagHeader_t *dag_h,
202 1.1 oster void *bp,
203 1.1 oster RF_RaidAccessFlags_t flags,
204 1.1 oster RF_AllocListElem_t *allocList,
205 1.1 oster RF_IoType_t type)
206 1.1 oster {
207 1.1 oster RF_DagNode_t *nodes, *diskNodes, *blockNode, *commitNode, *termNode;
208 1.1 oster RF_PhysDiskAddr_t *pda = asmap->physInfo;
209 1.1 oster int (*doFunc)(RF_DagNode_t *), (*undoFunc)(RF_DagNode_t *);
210 1.1 oster int i, n, totalNumNodes;
211 1.1 oster char *name;
212 1.1 oster
213 1.1 oster n = asmap->numStripeUnitsAccessed;
214 1.1 oster dag_h->creator = "NonredundantDAG";
215 1.1 oster
216 1.1 oster RF_ASSERT(RF_IO_IS_R_OR_W(type));
217 1.1 oster switch (type) {
218 1.1 oster case RF_IO_TYPE_READ:
219 1.1 oster doFunc = rf_DiskReadFunc;
220 1.1 oster undoFunc = rf_DiskReadUndoFunc;
221 1.1 oster name = "R ";
222 1.1 oster if (rf_dagDebug) printf("[Creating non-redundant read DAG]\n");
223 1.1 oster break;
224 1.1 oster case RF_IO_TYPE_WRITE:
225 1.1 oster doFunc = rf_DiskWriteFunc;
226 1.1 oster undoFunc = rf_DiskWriteUndoFunc;
227 1.1 oster name = "W ";
228 1.1 oster if (rf_dagDebug) printf("[Creating non-redundant write DAG]\n");
229 1.1 oster break;
230 1.1 oster default:
231 1.1 oster RF_PANIC();
232 1.1 oster }
233 1.1 oster
234 1.1 oster /*
235 1.1 oster * For reads, the dag can not commit until the block node is reached.
236 1.1 oster * for writes, the dag commits immediately.
237 1.1 oster */
238 1.1 oster dag_h->numCommitNodes = 1;
239 1.1 oster dag_h->numCommits = 0;
240 1.1 oster dag_h->numSuccedents = 1;
241 1.1 oster
242 1.1 oster /*
243 1.1 oster * Node count:
244 1.1 oster * 1 block node
245 1.1 oster * n data reads (or writes)
246 1.1 oster * 1 commit node
247 1.1 oster * 1 terminator node
248 1.1 oster */
249 1.1 oster RF_ASSERT(n > 0);
250 1.1 oster totalNumNodes = n + 3;
251 1.1 oster RF_CallocAndAdd(nodes, totalNumNodes, sizeof(RF_DagNode_t),
252 1.1 oster (RF_DagNode_t *), allocList);
253 1.1 oster i = 0;
254 1.1 oster diskNodes = &nodes[i]; i += n;
255 1.1 oster blockNode = &nodes[i]; i += 1;
256 1.1 oster commitNode = &nodes[i]; i += 1;
257 1.1 oster termNode = &nodes[i]; i += 1;
258 1.1 oster RF_ASSERT(i == totalNumNodes);
259 1.1 oster
260 1.1 oster /* initialize nodes */
261 1.1 oster switch (type) {
262 1.1 oster case RF_IO_TYPE_READ:
263 1.1 oster rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc,
264 1.1 oster NULL, n, 0, 0, 0, dag_h, "Nil", allocList);
265 1.1 oster rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, rf_NullNodeUndoFunc,
266 1.1 oster NULL, 1, n, 0, 0, dag_h, "Cmt", allocList);
267 1.1 oster rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, rf_TerminateUndoFunc,
268 1.1 oster NULL, 0, 1, 0, 0, dag_h, "Trm", allocList);
269 1.1 oster break;
270 1.1 oster case RF_IO_TYPE_WRITE:
271 1.1 oster rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc,
272 1.1 oster NULL, 1, 0, 0, 0, dag_h, "Nil", allocList);
273 1.1 oster rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, rf_NullNodeUndoFunc,
274 1.1 oster NULL, n, 1, 0, 0, dag_h, "Cmt", allocList);
275 1.1 oster rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, rf_TerminateUndoFunc,
276 1.1 oster NULL, 0, n, 0, 0, dag_h, "Trm", allocList);
277 1.1 oster break;
278 1.1 oster default:
279 1.1 oster RF_PANIC();
280 1.1 oster }
281 1.1 oster
282 1.1 oster for (i = 0; i < n; i++) {
283 1.1 oster RF_ASSERT(pda != NULL);
284 1.1 oster rf_InitNode(&diskNodes[i], rf_wait, RF_FALSE, doFunc, undoFunc, rf_GenericWakeupFunc,
285 1.1 oster 1, 1, 4, 0, dag_h, name, allocList);
286 1.1 oster diskNodes[i].params[0].p = pda;
287 1.1 oster diskNodes[i].params[1].p = pda->bufPtr;
288 1.1 oster /* parity stripe id is not necessary */
289 1.1 oster diskNodes[i].params[2].v = 0;
290 1.1 oster diskNodes[i].params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, 0);
291 1.1 oster pda = pda->next;
292 1.1 oster }
293 1.1 oster
294 1.1 oster /*
295 1.1 oster * Connect nodes.
296 1.1 oster */
297 1.1 oster
298 1.1 oster /* connect hdr to block node */
299 1.1 oster RF_ASSERT(blockNode->numAntecedents == 0);
300 1.1 oster dag_h->succedents[0] = blockNode;
301 1.1 oster
302 1.1 oster if (type == RF_IO_TYPE_READ) {
303 1.1 oster /* connecting a nonredundant read DAG */
304 1.1 oster RF_ASSERT(blockNode->numSuccedents == n);
305 1.1 oster RF_ASSERT(commitNode->numAntecedents == n);
306 1.1 oster for (i=0; i < n; i++) {
307 1.1 oster /* connect block node to each read node */
308 1.1 oster RF_ASSERT(diskNodes[i].numAntecedents == 1);
309 1.1 oster blockNode->succedents[i] = &diskNodes[i];
310 1.1 oster diskNodes[i].antecedents[0] = blockNode;
311 1.1 oster diskNodes[i].antType[0] = rf_control;
312 1.1 oster
313 1.1 oster /* connect each read node to the commit node */
314 1.1 oster RF_ASSERT(diskNodes[i].numSuccedents == 1);
315 1.1 oster diskNodes[i].succedents[0] = commitNode;
316 1.1 oster commitNode->antecedents[i] = &diskNodes[i];
317 1.1 oster commitNode->antType[i] = rf_control;
318 1.1 oster }
319 1.1 oster /* connect the commit node to the term node */
320 1.1 oster RF_ASSERT(commitNode->numSuccedents == 1);
321 1.1 oster RF_ASSERT(termNode->numAntecedents == 1);
322 1.1 oster RF_ASSERT(termNode->numSuccedents == 0);
323 1.1 oster commitNode->succedents[0] = termNode;
324 1.1 oster termNode->antecedents[0] = commitNode;
325 1.1 oster termNode->antType[0] = rf_control;
326 1.1 oster }
327 1.1 oster else {
328 1.1 oster /* connecting a nonredundant write DAG */
329 1.1 oster /* connect the block node to the commit node */
330 1.1 oster RF_ASSERT(blockNode->numSuccedents == 1);
331 1.1 oster RF_ASSERT(commitNode->numAntecedents == 1);
332 1.1 oster blockNode->succedents[0] = commitNode;
333 1.1 oster commitNode->antecedents[0] = blockNode;
334 1.1 oster commitNode->antType[0] = rf_control;
335 1.1 oster
336 1.1 oster RF_ASSERT(commitNode->numSuccedents == n);
337 1.1 oster RF_ASSERT(termNode->numAntecedents == n);
338 1.1 oster RF_ASSERT(termNode->numSuccedents == 0);
339 1.1 oster for (i=0; i < n; i++) {
340 1.1 oster /* connect the commit node to each write node */
341 1.1 oster RF_ASSERT(diskNodes[i].numAntecedents == 1);
342 1.1 oster commitNode->succedents[i] = &diskNodes[i];
343 1.1 oster diskNodes[i].antecedents[0] = commitNode;
344 1.1 oster diskNodes[i].antType[0] = rf_control;
345 1.1 oster
346 1.1 oster /* connect each write node to the term node */
347 1.1 oster RF_ASSERT(diskNodes[i].numSuccedents == 1);
348 1.1 oster diskNodes[i].succedents[0] = termNode;
349 1.1 oster termNode->antecedents[i] = &diskNodes[i];
350 1.1 oster termNode->antType[i] = rf_control;
351 1.1 oster }
352 1.1 oster }
353 1.1 oster }
354 1.1 oster
355 1.1 oster /******************************************************************************
356 1.1 oster * Create a fault-free read DAG for RAID level 1
357 1.1 oster *
358 1.1 oster * Hdr -> Nil -> Rmir -> Cmt -> Trm
359 1.1 oster *
360 1.1 oster * The "Rmir" node schedules a read from the disk in the mirror pair with the
361 1.1 oster * shortest disk queue. the proper queue is selected at Rmir execution. this
362 1.1 oster * deferred mapping is unlike other archs in RAIDframe which generally fix
363 1.1 oster * mapping at DAG creation time.
364 1.1 oster *
365 1.1 oster * Parameters: raidPtr - description of the physical array
366 1.1 oster * asmap - logical & physical addresses for this access
367 1.1 oster * bp - buffer ptr (for holding read data)
368 1.1 oster * flags - general flags (e.g. disk locking)
369 1.1 oster * allocList - list of memory allocated in DAG creation
370 1.1 oster *****************************************************************************/
371 1.1 oster
372 1.1 oster static void CreateMirrorReadDAG(
373 1.1 oster RF_Raid_t *raidPtr,
374 1.1 oster RF_AccessStripeMap_t *asmap,
375 1.1 oster RF_DagHeader_t *dag_h,
376 1.1 oster void *bp,
377 1.1 oster RF_RaidAccessFlags_t flags,
378 1.1 oster RF_AllocListElem_t *allocList,
379 1.1 oster int (*readfunc)(RF_DagNode_t *node))
380 1.1 oster {
381 1.1 oster RF_DagNode_t *readNodes, *nodes, *blockNode, *commitNode, *termNode;
382 1.1 oster RF_PhysDiskAddr_t *data_pda = asmap->physInfo;
383 1.1 oster RF_PhysDiskAddr_t *parity_pda = asmap->parityInfo;
384 1.1 oster int i, n, totalNumNodes;
385 1.1 oster
386 1.1 oster n = asmap->numStripeUnitsAccessed;
387 1.1 oster dag_h->creator = "RaidOneReadDAG";
388 1.1 oster if (rf_dagDebug) {
389 1.1 oster printf("[Creating RAID level 1 read DAG]\n");
390 1.1 oster }
391 1.1 oster
392 1.1 oster /*
393 1.1 oster * This dag can not commit until the commit node is reached
394 1.1 oster * errors prior to the commit point imply the dag has failed.
395 1.1 oster */
396 1.1 oster dag_h->numCommitNodes = 1;
397 1.1 oster dag_h->numCommits = 0;
398 1.1 oster dag_h->numSuccedents = 1;
399 1.1 oster
400 1.1 oster /*
401 1.1 oster * Node count:
402 1.1 oster * n data reads
403 1.1 oster * 1 block node
404 1.1 oster * 1 commit node
405 1.1 oster * 1 terminator node
406 1.1 oster */
407 1.1 oster RF_ASSERT(n > 0);
408 1.1 oster totalNumNodes = n + 3;
409 1.1 oster RF_CallocAndAdd(nodes, totalNumNodes, sizeof(RF_DagNode_t),
410 1.1 oster (RF_DagNode_t *), allocList);
411 1.1 oster i = 0;
412 1.1 oster readNodes = &nodes[i]; i += n;
413 1.1 oster blockNode = &nodes[i]; i += 1;
414 1.1 oster commitNode = &nodes[i]; i += 1;
415 1.1 oster termNode = &nodes[i]; i += 1;
416 1.1 oster RF_ASSERT(i == totalNumNodes);
417 1.1 oster
418 1.1 oster /* initialize nodes */
419 1.1 oster rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
420 1.1 oster rf_NullNodeUndoFunc, NULL, n, 0, 0, 0, dag_h, "Nil", allocList);
421 1.1 oster rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc,
422 1.1 oster rf_NullNodeUndoFunc, NULL, 1, n, 0, 0, dag_h, "Cmt", allocList);
423 1.1 oster rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc,
424 1.1 oster rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, dag_h, "Trm", allocList);
425 1.1 oster
426 1.1 oster for (i = 0; i < n; i++) {
427 1.1 oster RF_ASSERT(data_pda != NULL);
428 1.1 oster RF_ASSERT(parity_pda != NULL);
429 1.1 oster rf_InitNode(&readNodes[i], rf_wait, RF_FALSE, readfunc,
430 1.1 oster rf_DiskReadMirrorUndoFunc, rf_GenericWakeupFunc, 1, 1, 5, 0, dag_h,
431 1.1 oster "Rmir", allocList);
432 1.1 oster readNodes[i].params[0].p = data_pda;
433 1.1 oster readNodes[i].params[1].p = data_pda->bufPtr;
434 1.1 oster /* parity stripe id is not necessary */
435 1.1 oster readNodes[i].params[2].p = 0;
436 1.1 oster readNodes[i].params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, 0);
437 1.1 oster readNodes[i].params[4].p = parity_pda;
438 1.1 oster data_pda = data_pda->next;
439 1.1 oster parity_pda = parity_pda->next;
440 1.1 oster }
441 1.1 oster
442 1.1 oster /*
443 1.1 oster * Connect nodes
444 1.1 oster */
445 1.1 oster
446 1.1 oster /* connect hdr to block node */
447 1.1 oster RF_ASSERT(blockNode->numAntecedents == 0);
448 1.1 oster dag_h->succedents[0] = blockNode;
449 1.1 oster
450 1.1 oster /* connect block node to read nodes */
451 1.1 oster RF_ASSERT(blockNode->numSuccedents == n);
452 1.1 oster for (i=0; i < n; i++) {
453 1.1 oster RF_ASSERT(readNodes[i].numAntecedents == 1);
454 1.1 oster blockNode->succedents[i] = &readNodes[i];
455 1.1 oster readNodes[i].antecedents[0] = blockNode;
456 1.1 oster readNodes[i].antType[0] = rf_control;
457 1.1 oster }
458 1.1 oster
459 1.1 oster /* connect read nodes to commit node */
460 1.1 oster RF_ASSERT(commitNode->numAntecedents == n);
461 1.1 oster for (i=0; i < n; i++) {
462 1.1 oster RF_ASSERT(readNodes[i].numSuccedents == 1);
463 1.1 oster readNodes[i].succedents[0] = commitNode;
464 1.1 oster commitNode->antecedents[i] = &readNodes[i];
465 1.1 oster commitNode->antType[i] = rf_control;
466 1.1 oster }
467 1.1 oster
468 1.1 oster /* connect commit node to term node */
469 1.1 oster RF_ASSERT(commitNode->numSuccedents == 1);
470 1.1 oster RF_ASSERT(termNode->numAntecedents == 1);
471 1.1 oster RF_ASSERT(termNode->numSuccedents == 0);
472 1.1 oster commitNode->succedents[0] = termNode;
473 1.1 oster termNode->antecedents[0] = commitNode;
474 1.1 oster termNode->antType[0] = rf_control;
475 1.1 oster }
476 1.1 oster
477 1.1 oster void rf_CreateMirrorIdleReadDAG(
478 1.1 oster RF_Raid_t *raidPtr,
479 1.1 oster RF_AccessStripeMap_t *asmap,
480 1.1 oster RF_DagHeader_t *dag_h,
481 1.1 oster void *bp,
482 1.1 oster RF_RaidAccessFlags_t flags,
483 1.1 oster RF_AllocListElem_t *allocList)
484 1.1 oster {
485 1.1 oster CreateMirrorReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
486 1.1 oster rf_DiskReadMirrorIdleFunc);
487 1.1 oster }
488 1.1 oster
489 1.1 oster void rf_CreateMirrorPartitionReadDAG(
490 1.1 oster RF_Raid_t *raidPtr,
491 1.1 oster RF_AccessStripeMap_t *asmap,
492 1.1 oster RF_DagHeader_t *dag_h,
493 1.1 oster void *bp,
494 1.1 oster RF_RaidAccessFlags_t flags,
495 1.1 oster RF_AllocListElem_t *allocList)
496 1.1 oster {
497 1.1 oster CreateMirrorReadDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
498 1.1 oster rf_DiskReadMirrorPartitionFunc);
499 1.1 oster }
500