This source file includes following definitions.
- rf_CommonCreateParityLoggingLargeWriteDAG
- rf_CommonCreateParityLoggingSmallWriteDAG
- rf_CreateParityLoggingSmallWriteDAG
- rf_CreateParityLoggingLargeWriteDAG
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include "rf_archs.h"
32
33 #if RF_INCLUDE_PARITYLOGGING > 0
34
35
36
37
38
39 #include "rf_types.h"
40 #include "rf_raid.h"
41 #include "rf_dag.h"
42 #include "rf_dagutils.h"
43 #include "rf_dagfuncs.h"
44 #include "rf_debugMem.h"
45 #include "rf_paritylog.h"
46 #include "rf_memchunk.h"
47 #include "rf_general.h"
48
49 #include "rf_parityloggingdags.h"
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 void
75 rf_CommonCreateParityLoggingLargeWriteDAG(RF_Raid_t * raidPtr,
76 RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp,
77 RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList, int nfaults,
78 int (*redFunc) (RF_DagNode_t *))
79 {
80 RF_DagNode_t *nodes, *wndNodes, *rodNodes = NULL, *syncNode, *xorNode;
81 RF_DagNode_t *lpoNode, *blockNode, *unblockNode, *termNode;
82 int nWndNodes, nRodNodes, i;
83 RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout);
84 RF_AccessStripeMapHeader_t *new_asm_h[2];
85 int nodeNum, asmNum;
86 RF_ReconUnitNum_t which_ru;
87 char *sosBuffer, *eosBuffer;
88 RF_PhysDiskAddr_t *pda;
89 RF_StripeNum_t parityStripeID =
90 rf_RaidAddressToParityStripeID(&(raidPtr->Layout),
91 asmap->raidAddress, &which_ru);
92
93 if (rf_dagDebug)
94 printf("[Creating parity-logging large-write DAG]\n");
95 RF_ASSERT(nfaults == 1);
96 dag_h->creator = "ParityLoggingLargeWriteDAG";
97
98
99 nWndNodes = asmap->numStripeUnitsAccessed;
100 RF_CallocAndAdd(nodes, nWndNodes + 6, sizeof(RF_DagNode_t),
101 (RF_DagNode_t *), allocList);
102 i = 0;
103 wndNodes = &nodes[i];
104 i += nWndNodes;
105 xorNode = &nodes[i];
106 i += 1;
107 lpoNode = &nodes[i];
108 i += 1;
109 blockNode = &nodes[i];
110 i += 1;
111 syncNode = &nodes[i];
112 i += 1;
113 unblockNode = &nodes[i];
114 i += 1;
115 termNode = &nodes[i];
116 i += 1;
117
118 dag_h->numCommitNodes = nWndNodes + 1;
119 dag_h->numCommits = 0;
120 dag_h->numSuccedents = 1;
121
122 rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h,
123 new_asm_h, &nRodNodes, &sosBuffer, &eosBuffer, allocList);
124 if (nRodNodes > 0)
125 RF_CallocAndAdd(rodNodes, nRodNodes, sizeof(RF_DagNode_t),
126 (RF_DagNode_t *), allocList);
127
128
129 rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
130 rf_NullNodeUndoFunc, NULL, nRodNodes + 1, 0, 0, 0, dag_h,
131 "Nil", allocList);
132 rf_InitNode(unblockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
133 rf_NullNodeUndoFunc, NULL, 1, nWndNodes + 1, 0, 0, dag_h,
134 "Nil", allocList);
135 rf_InitNode(syncNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
136 rf_NullNodeUndoFunc, NULL, nWndNodes + 1, nRodNodes + 1,
137 0, 0, dag_h, "Nil", allocList);
138 rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc,
139 rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, dag_h, "Trm", allocList);
140
141
142 for (nodeNum = asmNum = 0; asmNum < 2; asmNum++) {
143 if (new_asm_h[asmNum]) {
144 pda = new_asm_h[asmNum]->stripeMap->physInfo;
145 while (pda) {
146 rf_InitNode(&rodNodes[nodeNum], rf_wait,
147 RF_FALSE, rf_DiskReadFunc,
148 rf_DiskReadUndoFunc, rf_GenericWakeupFunc,
149 1, 1, 4, 0, dag_h, "Rod", allocList);
150 rodNodes[nodeNum].params[0].p = pda;
151 rodNodes[nodeNum].params[1].p = pda->bufPtr;
152 rodNodes[nodeNum].params[2].v = parityStripeID;
153 rodNodes[nodeNum].params[3].v =
154 RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
155 0, 0, which_ru);
156 nodeNum++;
157 pda = pda->next;
158 }
159 }
160 }
161 RF_ASSERT(nodeNum == nRodNodes);
162
163
164 pda = asmap->physInfo;
165 for (i = 0; i < nWndNodes; i++) {
166 rf_InitNode(&wndNodes[i], rf_wait, RF_TRUE, rf_DiskWriteFunc,
167 rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0,
168 dag_h, "Wnd", allocList);
169 RF_ASSERT(pda != NULL);
170 wndNodes[i].params[0].p = pda;
171 wndNodes[i].params[1].p = pda->bufPtr;
172 wndNodes[i].params[2].v = parityStripeID;
173 wndNodes[i].params[3].v =
174 RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, which_ru);
175 pda = pda->next;
176 }
177
178
179 rf_InitNode(xorNode, rf_wait, RF_TRUE, redFunc, rf_NullNodeUndoFunc,
180 NULL, 1, 1, 2 * (nWndNodes + nRodNodes) + 1, 1, dag_h,
181 "Xr ", allocList);
182 xorNode->flags |= RF_DAGNODE_FLAG_YIELD;
183 for (i = 0; i < nWndNodes; i++) {
184
185 xorNode->params[2 * i + 0] = wndNodes[i].params[0];
186
187 xorNode->params[2 * i + 1] = wndNodes[i].params[1];
188 }
189 for (i = 0; i < nRodNodes; i++) {
190 xorNode->params[2 * (nWndNodes + i) + 0] =
191 rodNodes[i].params[0];
192 xorNode->params[2 * (nWndNodes + i) + 1] =
193 rodNodes[i].params[1];
194 }
195
196 xorNode->params[2 * (nWndNodes + nRodNodes)].p = raidPtr;
197
198
199
200
201
202
203
204 for (i = 0; i < nRodNodes; i++)
205 if (((RF_PhysDiskAddr_t *) rodNodes[i].params[0].p)
206 ->numSector == raidPtr->Layout.sectorsPerStripeUnit)
207 break;
208 if (i == nRodNodes) {
209 RF_CallocAndAdd(xorNode->results[0], 1,
210 rf_RaidAddressToByte(raidPtr,
211 raidPtr->Layout.sectorsPerStripeUnit), (void *),
212 allocList);
213 } else {
214 xorNode->results[0] = rodNodes[i].params[1].p;
215 }
216
217
218 rf_InitNode(lpoNode, rf_wait, RF_FALSE, rf_ParityLogOverwriteFunc,
219 rf_ParityLogOverwriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 2, 0,
220 dag_h, "Lpo", allocList);
221
222 lpoNode->params[0].p = asmap->parityInfo;
223 lpoNode->params[1].p = xorNode->results[0];
224
225 RF_ASSERT(asmap->parityInfo->next == NULL);
226
227
228
229
230 RF_ASSERT(dag_h->numSuccedents == 1);
231 RF_ASSERT(blockNode->numAntecedents == 0);
232 dag_h->succedents[0] = blockNode;
233
234
235 RF_ASSERT(blockNode->numSuccedents == nRodNodes + 1);
236 for (i = 0; i < nRodNodes; i++) {
237 RF_ASSERT(rodNodes[i].numAntecedents == 1);
238 blockNode->succedents[i] = &rodNodes[i];
239 rodNodes[i].antecedents[0] = blockNode;
240 rodNodes[i].antType[0] = rf_control;
241 }
242
243
244
245 RF_ASSERT(syncNode->numAntecedents == nRodNodes + 1);
246 blockNode->succedents[nRodNodes] = syncNode;
247 syncNode->antecedents[0] = blockNode;
248 syncNode->antType[0] = rf_control;
249
250
251 for (i = 0; i < nRodNodes; i++) {
252 rodNodes[i].succedents[0] = syncNode;
253 syncNode->antecedents[1 + i] = &rodNodes[i];
254 syncNode->antType[1 + i] = rf_control;
255 }
256
257
258 RF_ASSERT(syncNode->numSuccedents == nWndNodes + 1);
259 RF_ASSERT(xorNode->numAntecedents == 1);
260 syncNode->succedents[0] = xorNode;
261 xorNode->antecedents[0] = syncNode;
262 xorNode->antType[0] = rf_trueData;
263
264
265 for (i = 0; i < nWndNodes; i++) {
266 RF_ASSERT(wndNodes->numAntecedents == 1);
267 syncNode->succedents[1 + i] = &wndNodes[i];
268 wndNodes[i].antecedents[0] = syncNode;
269 wndNodes[i].antType[0] = rf_control;
270 }
271
272
273 RF_ASSERT(xorNode->numSuccedents == 1);
274 RF_ASSERT(lpoNode->numAntecedents == 1);
275 xorNode->succedents[0] = lpoNode;
276 lpoNode->antecedents[0] = xorNode;
277 lpoNode->antType[0] = rf_trueData;
278
279
280 RF_ASSERT(unblockNode->numAntecedents == nWndNodes + 1);
281 for (i = 0; i < nWndNodes; i++) {
282 RF_ASSERT(wndNodes->numSuccedents == 1);
283 wndNodes[i].succedents[0] = unblockNode;
284 unblockNode->antecedents[i] = &wndNodes[i];
285 unblockNode->antType[i] = rf_control;
286 }
287
288
289 RF_ASSERT(lpoNode->numSuccedents == 1);
290 lpoNode->succedents[0] = unblockNode;
291 unblockNode->antecedents[nWndNodes] = lpoNode;
292 unblockNode->antType[nWndNodes] = rf_control;
293
294
295 RF_ASSERT(unblockNode->numSuccedents == 1);
296 RF_ASSERT(termNode->numAntecedents == 1);
297 RF_ASSERT(termNode->numSuccedents == 0);
298 unblockNode->succedents[0] = termNode;
299 termNode->antecedents[0] = unblockNode;
300 termNode->antType[0] = rf_control;
301 }
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348 void
349 rf_CommonCreateParityLoggingSmallWriteDAG(RF_Raid_t *raidPtr,
350 RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp,
351 RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList,
352 RF_RedFuncs_t *pfuncs, RF_RedFuncs_t *qfuncs)
353 {
354 RF_DagNode_t *xorNodes, *blockNode, *unblockNode, *nodes;
355 RF_DagNode_t *readDataNodes, *readParityNodes;
356 RF_DagNode_t *writeDataNodes, *lpuNodes;
357 RF_DagNode_t *unlockDataNodes = NULL, *termNode;
358 RF_PhysDiskAddr_t *pda = asmap->physInfo;
359 int numDataNodes = asmap->numStripeUnitsAccessed;
360 int numParityNodes = (asmap->parityInfo->next) ? 2 : 1;
361 int i, j, nNodes, totalNumNodes;
362 RF_ReconUnitNum_t which_ru;
363 int (*func) (RF_DagNode_t * node), (*undoFunc) (RF_DagNode_t * node);
364 int (*qfunc) (RF_DagNode_t * node);
365 char*name, *qname;
366 RF_StripeNum_t parityStripeID =
367 rf_RaidAddressToParityStripeID(&(raidPtr->Layout),
368 asmap->raidAddress, &which_ru);
369 long nfaults = qfuncs ? 2 : 1;
370 int lu_flag = (rf_enableAtomicRMW) ? 1 : 0;
371
372 if (rf_dagDebug)
373 printf("[Creating parity-logging small-write DAG]\n");
374 RF_ASSERT(numDataNodes > 0);
375 RF_ASSERT(nfaults == 1);
376 dag_h->creator = "ParityLoggingSmallWriteDAG";
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394 totalNumNodes = (2 * numDataNodes) + numParityNodes +
395 (2 * numParityNodes) + 3;
396 if (lu_flag)
397 totalNumNodes += numDataNodes;
398
399 nNodes = numDataNodes + numParityNodes;
400
401 dag_h->numCommitNodes = numDataNodes + numParityNodes;
402 dag_h->numCommits = 0;
403 dag_h->numSuccedents = 1;
404
405
406 RF_CallocAndAdd(nodes, totalNumNodes, sizeof(RF_DagNode_t),
407 (RF_DagNode_t *), allocList);
408 i = 0;
409 blockNode = &nodes[i];
410 i += 1;
411 unblockNode = &nodes[i];
412 i += 1;
413 readDataNodes = &nodes[i];
414 i += numDataNodes;
415 readParityNodes = &nodes[i];
416 i += numParityNodes;
417 writeDataNodes = &nodes[i];
418 i += numDataNodes;
419 lpuNodes = &nodes[i];
420 i += numParityNodes;
421 xorNodes = &nodes[i];
422 i += numParityNodes;
423 termNode = &nodes[i];
424 i += 1;
425 if (lu_flag) {
426 unlockDataNodes = &nodes[i];
427 i += numDataNodes;
428 }
429 RF_ASSERT(i == totalNumNodes);
430
431
432
433 rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
434 rf_NullNodeUndoFunc, NULL, nNodes, 0, 0, 0, dag_h,
435 "Nil", allocList);
436
437
438 rf_InitNode(unblockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
439 rf_NullNodeUndoFunc, NULL, 1, nNodes, 0, 0, dag_h,
440 "Nil", allocList);
441
442
443 rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc,
444 rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, dag_h, "Trm", allocList);
445
446
447 for (i = 0; i < numDataNodes; i++) {
448 rf_InitNode(&readDataNodes[i], rf_wait, RF_FALSE,
449 rf_DiskReadFunc, rf_DiskReadUndoFunc, rf_GenericWakeupFunc,
450 nNodes, 1, 4, 0, dag_h, "Rod", allocList);
451 RF_ASSERT(pda != NULL);
452
453 readDataNodes[i].params[0].p = pda;
454 readDataNodes[i].params[1].p = rf_AllocBuffer(raidPtr, dag_h,
455 pda, allocList);
456 readDataNodes[i].params[2].v = parityStripeID;
457 readDataNodes[i].params[3].v =
458 RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, lu_flag,
459 0, which_ru);
460 pda = pda->next;
461 readDataNodes[i].propList[0] = NULL;
462 readDataNodes[i].propList[1] = NULL;
463 }
464
465
466 pda = asmap->parityInfo;
467 i = 0;
468 for (i = 0; i < numParityNodes; i++) {
469 RF_ASSERT(pda != NULL);
470 rf_InitNode(&readParityNodes[i], rf_wait, RF_FALSE,
471 rf_DiskReadFunc, rf_DiskReadUndoFunc, rf_GenericWakeupFunc,
472 nNodes, 1, 4, 0, dag_h, "Rop", allocList);
473 readParityNodes[i].params[0].p = pda;
474 readParityNodes[i].params[1].p = rf_AllocBuffer(raidPtr, dag_h,
475 pda, allocList);
476 readParityNodes[i].params[2].v = parityStripeID;
477 readParityNodes[i].params[3].v =
478 RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, which_ru);
479 readParityNodes[i].propList[0] = NULL;
480 pda = pda->next;
481 }
482
483
484 pda = asmap->physInfo;
485 for (i = 0; i < numDataNodes; i++) {
486 RF_ASSERT(pda != NULL);
487 rf_InitNode(&writeDataNodes[i], rf_wait, RF_TRUE,
488 rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
489 rf_GenericWakeupFunc, 1, nNodes, 4, 0, dag_h,
490 "Wnd", allocList);
491
492 writeDataNodes[i].params[0].p = pda;
493
494 writeDataNodes[i].params[1].p = pda->bufPtr;
495 writeDataNodes[i].params[2].v = parityStripeID;
496 writeDataNodes[i].params[3].v =
497 RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, which_ru);
498
499 if (lu_flag) {
500
501 rf_InitNode(&unlockDataNodes[i], rf_wait, RF_FALSE,
502 rf_DiskUnlockFunc, rf_DiskUnlockUndoFunc,
503 rf_GenericWakeupFunc, 1, 1, 2, 0, dag_h,
504 "Und", allocList);
505
506 unlockDataNodes[i].params[0].p = pda;
507 unlockDataNodes[i].params[1].v =
508 RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0,
509 lu_flag, which_ru);
510 }
511 pda = pda->next;
512 }
513
514
515
516
517
518
519
520
521
522
523
524
525 if ((numParityNodes == 2) || ((numDataNodes == 1) &&
526 (asmap->totalSectorsAccessed <
527 raidPtr->Layout.sectorsPerStripeUnit))) {
528 func = pfuncs->simple;
529 undoFunc = rf_NullNodeUndoFunc;
530 name = pfuncs->SimpleName;
531 if (qfuncs) {
532 qfunc = qfuncs->simple;
533 qname = qfuncs->SimpleName;
534 }
535 } else {
536 func = pfuncs->regular;
537 undoFunc = rf_NullNodeUndoFunc;
538 name = pfuncs->RegularName;
539 if (qfuncs) {
540 qfunc = qfuncs->regular;
541 qname = qfuncs->RegularName;
542 }
543 }
544
545
546
547
548 if (numParityNodes == 2) {
549 for (i = 0; i < numParityNodes; i++) {
550 rf_InitNode(&xorNodes[i], rf_wait, RF_TRUE, func,
551 undoFunc, NULL, 1, nNodes, 7, 1, dag_h, name,
552 allocList);
553 xorNodes[i].flags |= RF_DAGNODE_FLAG_YIELD;
554 xorNodes[i].params[0] = readDataNodes[i].params[0];
555 xorNodes[i].params[1] = readDataNodes[i].params[1];
556 xorNodes[i].params[2] = readParityNodes[i].params[0];
557 xorNodes[i].params[3] = readParityNodes[i].params[1];
558 xorNodes[i].params[4] = writeDataNodes[i].params[0];
559 xorNodes[i].params[5] = writeDataNodes[i].params[1];
560 xorNodes[i].params[6].p = raidPtr;
561
562 xorNodes[i].results[0] = readParityNodes[i].params[1].p;
563 }
564 } else {
565
566 rf_InitNode(&xorNodes[0], rf_wait, RF_TRUE, func, undoFunc,
567 NULL, 1, nNodes,
568 (2 * (numDataNodes + numDataNodes + 1) + 1), 1,
569 dag_h, name, allocList);
570 xorNodes[0].flags |= RF_DAGNODE_FLAG_YIELD;
571 for (i = 0; i < numDataNodes + 1; i++) {
572
573 xorNodes[0].params[2 * i + 0] =
574 readDataNodes[i].params[0];
575 xorNodes[0].params[2 * i + 1] =
576 readDataNodes[i].params[1];
577 }
578 for (i = 0; i < numDataNodes; i++) {
579
580 xorNodes[0].params[2 * (numDataNodes + 1 + i) + 0] =
581 writeDataNodes[i].params[0];
582 xorNodes[0].params[2 * (numDataNodes + 1 + i) + 1] =
583 writeDataNodes[i].params[1];
584 }
585 xorNodes[0].params[2 * (numDataNodes + numDataNodes + 1)].p =
586 raidPtr;
587 xorNodes[0].results[0] = readParityNodes[0].params[1].p;
588 }
589
590
591 pda = asmap->parityInfo;
592 for (i = 0; i < numParityNodes; i++) {
593 RF_ASSERT(pda);
594 rf_InitNode(&lpuNodes[i], rf_wait, RF_FALSE,
595 rf_ParityLogUpdateFunc, rf_ParityLogUpdateUndoFunc,
596 rf_GenericWakeupFunc, 1, 1, 2, 0, dag_h, "Lpu", allocList);
597 lpuNodes[i].params[0].p = pda;
598
599 lpuNodes[i].params[1].p = xorNodes[i].results[0];
600 pda = pda->next;
601 }
602
603
604
605
606
607 RF_ASSERT(dag_h->numSuccedents == 1);
608 RF_ASSERT(blockNode->numAntecedents == 0);
609 dag_h->succedents[0] = blockNode;
610
611
612 RF_ASSERT(blockNode->numSuccedents == (numDataNodes + numParityNodes));
613 for (i = 0; i < numDataNodes; i++) {
614 blockNode->succedents[i] = &readDataNodes[i];
615 RF_ASSERT(readDataNodes[i].numAntecedents == 1);
616 readDataNodes[i].antecedents[0] = blockNode;
617 readDataNodes[i].antType[0] = rf_control;
618 }
619
620
621 for (i = 0; i < numParityNodes; i++) {
622 blockNode->succedents[numDataNodes + i] = &readParityNodes[i];
623 RF_ASSERT(readParityNodes[i].numAntecedents == 1);
624 readParityNodes[i].antecedents[0] = blockNode;
625 readParityNodes[i].antType[0] = rf_control;
626 }
627
628
629 for (i = 0; i < numDataNodes; i++) {
630 RF_ASSERT(readDataNodes[i].numSuccedents ==
631 numDataNodes + numParityNodes);
632 for (j = 0; j < numDataNodes; j++) {
633 RF_ASSERT(writeDataNodes[j].numAntecedents ==
634 numDataNodes + numParityNodes);
635 readDataNodes[i].succedents[j] = &writeDataNodes[j];
636 writeDataNodes[j].antecedents[i] = &readDataNodes[i];
637 if (i == j)
638 writeDataNodes[j].antType[i] = rf_antiData;
639 else
640 writeDataNodes[j].antType[i] = rf_control;
641 }
642 }
643
644
645 for (i = 0; i < numDataNodes; i++)
646 for (j = 0; j < numParityNodes; j++) {
647 RF_ASSERT(xorNodes[j].numAntecedents ==
648 numDataNodes + numParityNodes);
649 readDataNodes[i].succedents[numDataNodes + j] =
650 &xorNodes[j];
651 xorNodes[j].antecedents[i] = &readDataNodes[i];
652 xorNodes[j].antType[i] = rf_trueData;
653 }
654
655
656 for (i = 0; i < numParityNodes; i++) {
657 RF_ASSERT(readParityNodes[i].numSuccedents ==
658 numDataNodes + numParityNodes);
659 for (j = 0; j < numDataNodes; j++) {
660 readParityNodes[i].succedents[j] = &writeDataNodes[j];
661 writeDataNodes[j].antecedents[numDataNodes + i] =
662 &readParityNodes[i];
663 writeDataNodes[j].antType[numDataNodes + i] =
664 rf_control;
665 }
666 }
667
668
669 for (i = 0; i < numParityNodes; i++)
670 for (j = 0; j < numParityNodes; j++) {
671 readParityNodes[i].succedents[numDataNodes + j] =
672 &xorNodes[j];
673 xorNodes[j].antecedents[numDataNodes + i] =
674 &readParityNodes[i];
675 xorNodes[j].antType[numDataNodes + i] = rf_trueData;
676 }
677
678
679 for (i = 0; i < numParityNodes; i++) {
680 RF_ASSERT(xorNodes[i].numSuccedents == 1);
681 RF_ASSERT(lpuNodes[i].numAntecedents == 1);
682 xorNodes[i].succedents[0] = &lpuNodes[i];
683 lpuNodes[i].antecedents[0] = &xorNodes[i];
684 lpuNodes[i].antType[0] = rf_trueData;
685 }
686
687 for (i = 0; i < numDataNodes; i++) {
688 if (lu_flag) {
689
690 RF_ASSERT(writeDataNodes[i].numSuccedents == 1);
691 RF_ASSERT(unlockDataNodes[i].numAntecedents == 1);
692 writeDataNodes[i].succedents[0] = &unlockDataNodes[i];
693 unlockDataNodes[i].antecedents[0] = &writeDataNodes[i];
694 unlockDataNodes[i].antType[0] = rf_control;
695
696
697 RF_ASSERT(unlockDataNodes[i].numSuccedents == 1);
698 RF_ASSERT(unblockNode->numAntecedents ==
699 (numDataNodes + (nfaults * numParityNodes)));
700 unlockDataNodes[i].succedents[0] = unblockNode;
701 unblockNode->antecedents[i] = &unlockDataNodes[i];
702 unblockNode->antType[i] = rf_control;
703 } else {
704
705 RF_ASSERT(writeDataNodes[i].numSuccedents == 1);
706 RF_ASSERT(unblockNode->numAntecedents ==
707 (numDataNodes + (nfaults * numParityNodes)));
708 writeDataNodes[i].succedents[0] = unblockNode;
709 unblockNode->antecedents[i] = &writeDataNodes[i];
710 unblockNode->antType[i] = rf_control;
711 }
712 }
713
714
715 for (i = 0; i < numParityNodes; i++) {
716 RF_ASSERT(lpuNodes[i].numSuccedents == 1);
717 lpuNodes[i].succedents[0] = unblockNode;
718 unblockNode->antecedents[numDataNodes + i] = &lpuNodes[i];
719 unblockNode->antType[numDataNodes + i] = rf_control;
720 }
721
722
723 RF_ASSERT(unblockNode->numSuccedents == 1);
724 RF_ASSERT(termNode->numAntecedents == 1);
725 RF_ASSERT(termNode->numSuccedents == 0);
726 unblockNode->succedents[0] = termNode;
727 termNode->antecedents[0] = unblockNode;
728 termNode->antType[0] = rf_control;
729 }
730
731
732 void
733 rf_CreateParityLoggingSmallWriteDAG(RF_Raid_t *raidPtr,
734 RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp,
735 RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList,
736 RF_RedFuncs_t *pfuncs, RF_RedFuncs_t *qfuncs)
737 {
738 dag_h->creator = "ParityLoggingSmallWriteDAG";
739 rf_CommonCreateParityLoggingSmallWriteDAG(raidPtr, asmap, dag_h, bp,
740 flags, allocList, &rf_xorFuncs, NULL);
741 }
742
743
744 void
745 rf_CreateParityLoggingLargeWriteDAG(RF_Raid_t *raidPtr,
746 RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp,
747 RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList, int nfaults,
748 int (*redFunc) (RF_DagNode_t *))
749 {
750 dag_h->creator = "ParityLoggingSmallWriteDAG";
751 rf_CommonCreateParityLoggingLargeWriteDAG(raidPtr, asmap, dag_h, bp,
752 flags, allocList, 1, rf_RegularXorFunc);
753 }
754 #endif