2004-03-20 07:22:05 +03:00
|
|
|
/* $NetBSD: rf_dagffwr.c,v 1.23 2004/03/20 04:22:05 oster Exp $ */
|
1998-11-13 07:20:26 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1995 Carnegie-Mellon University.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Mark Holland, Daniel Stodolsky, William V. Courtright II
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* rf_dagff.c
|
|
|
|
*
|
|
|
|
* code for creating fault-free DAGs
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2001-11-13 10:11:12 +03:00
|
|
|
#include <sys/cdefs.h>
|
2004-03-20 07:22:05 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.23 2004/03/20 04:22:05 oster Exp $");
|
2001-11-13 10:11:12 +03:00
|
|
|
|
2001-10-04 19:58:51 +04:00
|
|
|
#include <dev/raidframe/raidframevar.h>
|
|
|
|
|
1998-11-13 07:20:26 +03:00
|
|
|
#include "rf_raid.h"
|
|
|
|
#include "rf_dag.h"
|
|
|
|
#include "rf_dagutils.h"
|
|
|
|
#include "rf_dagfuncs.h"
|
|
|
|
#include "rf_debugMem.h"
|
|
|
|
#include "rf_dagffrd.h"
|
|
|
|
#include "rf_general.h"
|
|
|
|
#include "rf_dagffwr.h"
|
2004-03-20 07:22:05 +03:00
|
|
|
#include "rf_map.h"
|
1998-11-13 07:20:26 +03:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* General comments on DAG creation:
|
1999-02-05 03:06:06 +03:00
|
|
|
*
|
1998-11-13 07:20:26 +03:00
|
|
|
* All DAGs in this file use roll-away error recovery. Each DAG has a single
|
|
|
|
* commit node, usually called "Cmt." If an error occurs before the Cmt node
|
|
|
|
* is reached, the execution engine will halt forward execution and work
|
|
|
|
* backward through the graph, executing the undo functions. Assuming that
|
|
|
|
* each node in the graph prior to the Cmt node are undoable and atomic - or -
|
|
|
|
* does not make changes to permanent state, the graph will fail atomically.
|
|
|
|
* If an error occurs after the Cmt node executes, the engine will roll-forward
|
|
|
|
* through the graph, blindly executing nodes until it reaches the end.
|
|
|
|
* If a graph reaches the end, it is assumed to have completed successfully.
|
|
|
|
*
|
|
|
|
* A graph has only 1 Cmt node.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* The following wrappers map the standard DAG creation interface to the
|
|
|
|
* DAG creation routines. Additionally, these wrappers enable experimentation
|
|
|
|
* with new DAG structures by providing an extra level of indirection, allowing
|
|
|
|
* the DAG creation routines to be replaced at this single point.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CreateNonRedundantWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList,
|
|
|
|
RF_IoType_t type)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
rf_CreateNonredundantDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
|
2004-01-06 06:27:13 +03:00
|
|
|
RF_IO_TYPE_WRITE);
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CreateRAID0WriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList,
|
|
|
|
RF_IoType_t type)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
rf_CreateNonredundantDAG(raidPtr, asmap, dag_h, bp, flags, allocList,
|
2004-01-06 06:27:13 +03:00
|
|
|
RF_IO_TYPE_WRITE);
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
/* "normal" rollaway */
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags,
|
|
|
|
allocList, &rf_xorFuncs, NULL);
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
/* "normal" rollaway */
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags,
|
|
|
|
allocList, 1, rf_RegularXorFunc, RF_TRUE);
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* DAG creation code begins here
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* creates a DAG to perform a large-write operation:
|
|
|
|
*
|
|
|
|
* / Rod \ / Wnd \
|
|
|
|
* H -- block- Rod - Xor - Cmt - Wnd --- T
|
|
|
|
* \ Rod / \ Wnp /
|
|
|
|
* \[Wnq]/
|
|
|
|
*
|
|
|
|
* The XOR node also does the Q calculation in the P+Q architecture.
|
|
|
|
* All nodes are before the commit node (Cmt) are assumed to be atomic and
|
|
|
|
* undoable - or - they make no changes to permanent state.
|
|
|
|
*
|
|
|
|
* Rod = read old data
|
|
|
|
* Cmt = commit node
|
|
|
|
* Wnp = write new parity
|
|
|
|
* Wnd = write new data
|
|
|
|
* Wnq = write new "q"
|
|
|
|
* [] denotes optional segments in the graph
|
|
|
|
*
|
|
|
|
* Parameters: raidPtr - description of the physical array
|
|
|
|
* asmap - logical & physical addresses for this access
|
|
|
|
* bp - buffer ptr (holds write data)
|
1999-02-05 03:06:06 +03:00
|
|
|
* flags - general flags (e.g. disk locking)
|
1998-11-13 07:20:26 +03:00
|
|
|
* allocList - list of memory allocated in DAG creation
|
|
|
|
* nfaults - number of faults array can tolerate
|
|
|
|
* (equal to # redundancy units in stripe)
|
|
|
|
* redfuncs - list of redundancy generating functions
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList,
|
|
|
|
int nfaults, int (*redFunc) (RF_DagNode_t *),
|
|
|
|
int allowBufferRecycle)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_DagNode_t *wndNodes, *rodNodes, *xorNode, *wnpNode, *tmpNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_DagNode_t *wnqNode, *blockNode, *commitNode, *termNode;
|
|
|
|
int nWndNodes, nRodNodes, i, nodeNum, asmNum;
|
|
|
|
RF_AccessStripeMapHeader_t *new_asm_h[2];
|
|
|
|
RF_StripeNum_t parityStripeID;
|
|
|
|
char *sosBuffer, *eosBuffer;
|
|
|
|
RF_ReconUnitNum_t which_ru;
|
|
|
|
RF_RaidLayout_t *layoutPtr;
|
|
|
|
RF_PhysDiskAddr_t *pda;
|
2004-03-20 07:22:05 +03:00
|
|
|
RF_VoidPointerListElem_t *vple;
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
layoutPtr = &(raidPtr->Layout);
|
2004-01-06 06:27:13 +03:00
|
|
|
parityStripeID = rf_RaidAddressToParityStripeID(layoutPtr,
|
|
|
|
asmap->raidAddress,
|
|
|
|
&which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
|
2004-03-05 06:22:05 +03:00
|
|
|
#if RF_DEBUG_DAG
|
1999-02-05 03:06:06 +03:00
|
|
|
if (rf_dagDebug) {
|
|
|
|
printf("[Creating large-write DAG]\n");
|
|
|
|
}
|
2004-03-05 06:22:05 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
dag_h->creator = "LargeWriteDAG";
|
|
|
|
|
|
|
|
dag_h->numCommitNodes = 1;
|
|
|
|
dag_h->numCommits = 0;
|
|
|
|
dag_h->numSuccedents = 1;
|
|
|
|
|
|
|
|
/* alloc the nodes: Wnd, xor, commit, block, term, and Wnp */
|
|
|
|
nWndNodes = asmap->numStripeUnitsAccessed;
|
2004-03-18 19:40:05 +03:00
|
|
|
|
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
wndNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
xorNode = rf_AllocDAGNode();
|
|
|
|
xorNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = xorNode;
|
|
|
|
|
|
|
|
wnpNode = rf_AllocDAGNode();
|
|
|
|
wnpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = wnpNode;
|
|
|
|
|
|
|
|
blockNode = rf_AllocDAGNode();
|
|
|
|
blockNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = blockNode;
|
|
|
|
|
|
|
|
commitNode = rf_AllocDAGNode();
|
|
|
|
commitNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = commitNode;
|
|
|
|
|
|
|
|
termNode = rf_AllocDAGNode();
|
|
|
|
termNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = termNode;
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
wnqNode = rf_AllocDAGNode();
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
wnqNode = NULL;
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h,
|
|
|
|
new_asm_h, &nRodNodes, &sosBuffer,
|
|
|
|
&eosBuffer, allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nRodNodes > 0) {
|
2004-03-18 19:40:05 +03:00
|
|
|
for (i = 0; i < nRodNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
rodNodes = dag_h->nodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
|
|
|
rodNodes = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* begin node initialization */
|
|
|
|
if (nRodNodes > 0) {
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, nRodNodes, 0, 0, 0,
|
|
|
|
dag_h, "Nil", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, 1, 0, 0, 0,
|
|
|
|
dag_h, "Nil", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, nWndNodes + nfaults, 1, 0, 0,
|
|
|
|
dag_h, "Cmt", allocList);
|
|
|
|
rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc,
|
|
|
|
rf_TerminateUndoFunc, NULL, 0, nWndNodes + nfaults, 0, 0,
|
|
|
|
dag_h, "Trm", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* initialize the Rod nodes */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = rodNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (nodeNum = asmNum = 0; asmNum < 2; asmNum++) {
|
|
|
|
if (new_asm_h[asmNum]) {
|
|
|
|
pda = new_asm_h[asmNum]->stripeMap->physInfo;
|
|
|
|
while (pda) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpNode, rf_wait,
|
2004-01-06 06:27:13 +03:00
|
|
|
RF_FALSE, rf_DiskReadFunc,
|
|
|
|
rf_DiskReadUndoFunc,
|
|
|
|
rf_GenericWakeupFunc,
|
|
|
|
1, 1, 4, 0, dag_h,
|
|
|
|
"Rod", allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode->params[0].p = pda;
|
|
|
|
tmpNode->params[1].p = pda->bufPtr;
|
|
|
|
tmpNode->params[2].v = parityStripeID;
|
|
|
|
tmpNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
nodeNum++;
|
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RF_ASSERT(nodeNum == nRodNodes);
|
|
|
|
|
|
|
|
/* initialize the wnd nodes */
|
|
|
|
pda = asmap->physInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = wndNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, 1, 1, 4, 0,
|
|
|
|
dag_h, "Wnd", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode->params[0].p = pda;
|
|
|
|
tmpNode->params[1].p = pda->bufPtr;
|
|
|
|
tmpNode->params[2].v = parityStripeID;
|
|
|
|
tmpNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the redundancy node */
|
|
|
|
if (nRodNodes > 0) {
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(xorNode, rf_wait, RF_FALSE, redFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, 1,
|
|
|
|
nRodNodes, 2 * (nWndNodes + nRodNodes) + 1,
|
|
|
|
nfaults, dag_h, "Xr ", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(xorNode, rf_wait, RF_FALSE, redFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, 1,
|
|
|
|
1, 2 * (nWndNodes + nRodNodes) + 1,
|
|
|
|
nfaults, dag_h, "Xr ", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
xorNode->flags |= RF_DAGNODE_FLAG_YIELD;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = wndNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
2004-01-06 06:27:13 +03:00
|
|
|
/* pda */
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNode->params[2 * i + 0] = tmpNode->params[0];
|
2004-01-06 06:27:13 +03:00
|
|
|
/* buf ptr */
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNode->params[2 * i + 1] = tmpNode->params[1];
|
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = rodNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nRodNodes; i++) {
|
2004-01-06 06:27:13 +03:00
|
|
|
/* pda */
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNode->params[2 * (nWndNodes + i) + 0] = tmpNode->params[0];
|
2004-01-06 06:27:13 +03:00
|
|
|
/* buf ptr */
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNode->params[2 * (nWndNodes + i) + 1] = tmpNode->params[1];
|
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
/* xor node needs to get at RAID information */
|
|
|
|
xorNode->params[2 * (nWndNodes + nRodNodes)].p = raidPtr;
|
|
|
|
|
|
|
|
/*
|
2004-01-06 06:27:13 +03:00
|
|
|
* Look for an Rod node that reads a complete SU. If none,
|
|
|
|
* alloc a buffer to receive the parity info. Note that we
|
|
|
|
* can't use a new data buffer because it will not have gotten
|
|
|
|
* written when the xor occurs. */
|
1999-02-05 03:06:06 +03:00
|
|
|
if (allowBufferRecycle) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = rodNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nRodNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
if (((RF_PhysDiskAddr_t *) tmpNode->params[0].p)->numSector == raidPtr->Layout.sectorsPerStripeUnit)
|
1999-02-05 03:06:06 +03:00
|
|
|
break;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((!allowBufferRecycle) || (i == nRodNodes)) {
|
2004-03-20 07:22:05 +03:00
|
|
|
xorNode->results[0] = rf_AllocIOBuffer(raidPtr,
|
|
|
|
rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit));
|
|
|
|
vple = rf_AllocVPListElem();
|
|
|
|
vple->p = xorNode->results[0];
|
|
|
|
vple->next = dag_h->iobufs;
|
|
|
|
dag_h->iobufs = vple;
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
2004-03-18 19:40:05 +03:00
|
|
|
/* this works because the only way we get here is if
|
|
|
|
allowBufferRecycle is true and we went through the
|
|
|
|
above for loop, and exited via the break before
|
|
|
|
i==nRodNodes was true. That means tmpNode will
|
|
|
|
still point to a valid node -- the one we want for
|
|
|
|
here! */
|
|
|
|
xorNode->results[0] = tmpNode->params[1].p;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the Wnp node */
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(wnpNode, rf_wait, RF_FALSE, rf_DiskWriteFunc,
|
|
|
|
rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0,
|
|
|
|
dag_h, "Wnp", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
wnpNode->params[0].p = asmap->parityInfo;
|
|
|
|
wnpNode->params[1].p = xorNode->results[0];
|
|
|
|
wnpNode->params[2].v = parityStripeID;
|
2004-01-10 03:56:27 +03:00
|
|
|
wnpNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
/* parityInfo must describe entire parity unit */
|
|
|
|
RF_ASSERT(asmap->parityInfo->next == NULL);
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
|
|
|
/*
|
|
|
|
* We never try to recycle a buffer for the Q calcuation
|
|
|
|
* in addition to the parity. This would cause two buffers
|
|
|
|
* to get smashed during the P and Q calculation, guaranteeing
|
|
|
|
* one would be wrong.
|
|
|
|
*/
|
2003-12-29 06:33:47 +03:00
|
|
|
RF_MallocAndAdd(xorNode->results[1],
|
|
|
|
rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit),
|
|
|
|
(void *), allocList);
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(wnqNode, rf_wait, RF_FALSE, rf_DiskWriteFunc,
|
|
|
|
rf_DiskWriteUndoFunc, rf_GenericWakeupFunc,
|
|
|
|
1, 1, 4, 0, dag_h, "Wnq", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
wnqNode->params[0].p = asmap->qInfo;
|
|
|
|
wnqNode->params[1].p = xorNode->results[1];
|
|
|
|
wnqNode->params[2].v = parityStripeID;
|
2004-01-10 03:56:27 +03:00
|
|
|
wnqNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
/* parityInfo must describe entire parity unit */
|
|
|
|
RF_ASSERT(asmap->parityInfo->next == NULL);
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/*
|
|
|
|
* Connect nodes to form graph.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* connect dag header to block node */
|
|
|
|
RF_ASSERT(blockNode->numAntecedents == 0);
|
|
|
|
dag_h->succedents[0] = blockNode;
|
|
|
|
|
|
|
|
if (nRodNodes > 0) {
|
|
|
|
/* connect the block node to the Rod nodes */
|
|
|
|
RF_ASSERT(blockNode->numSuccedents == nRodNodes);
|
|
|
|
RF_ASSERT(xorNode->numAntecedents == nRodNodes);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = rodNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nRodNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpNode.numAntecedents == 1);
|
|
|
|
blockNode->succedents[i] = tmpNode;
|
|
|
|
tmpNode->antecedents[0] = blockNode;
|
|
|
|
tmpNode->antType[0] = rf_control;
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* connect the Rod nodes to the Xor node */
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpNode.numSuccedents == 1);
|
|
|
|
tmpNode->succedents[0] = xorNode;
|
|
|
|
xorNode->antecedents[i] = tmpNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
xorNode->antType[i] = rf_trueData;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* connect the block node to the Xor node */
|
|
|
|
RF_ASSERT(blockNode->numSuccedents == 1);
|
|
|
|
RF_ASSERT(xorNode->numAntecedents == 1);
|
|
|
|
blockNode->succedents[0] = xorNode;
|
|
|
|
xorNode->antecedents[0] = blockNode;
|
|
|
|
xorNode->antType[0] = rf_control;
|
|
|
|
}
|
1998-11-13 07:20:26 +03:00
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect the xor node to the commit node */
|
|
|
|
RF_ASSERT(xorNode->numSuccedents == 1);
|
|
|
|
RF_ASSERT(commitNode->numAntecedents == 1);
|
|
|
|
xorNode->succedents[0] = commitNode;
|
|
|
|
commitNode->antecedents[0] = xorNode;
|
|
|
|
commitNode->antType[0] = rf_control;
|
|
|
|
|
|
|
|
/* connect the commit node to the write nodes */
|
|
|
|
RF_ASSERT(commitNode->numSuccedents == nWndNodes + nfaults);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = wndNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
|
|
|
RF_ASSERT(wndNodes->numAntecedents == 1);
|
2004-03-18 19:40:05 +03:00
|
|
|
commitNode->succedents[i] = tmpNode;
|
|
|
|
tmpNode->antecedents[0] = commitNode;
|
|
|
|
tmpNode->antType[0] = rf_control;
|
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
RF_ASSERT(wnpNode->numAntecedents == 1);
|
|
|
|
commitNode->succedents[nWndNodes] = wnpNode;
|
|
|
|
wnpNode->antecedents[0] = commitNode;
|
|
|
|
wnpNode->antType[0] = rf_trueData;
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
|
|
|
RF_ASSERT(wnqNode->numAntecedents == 1);
|
|
|
|
commitNode->succedents[nWndNodes + 1] = wnqNode;
|
|
|
|
wnqNode->antecedents[0] = commitNode;
|
|
|
|
wnqNode->antType[0] = rf_trueData;
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect the write nodes to the term node */
|
|
|
|
RF_ASSERT(termNode->numAntecedents == nWndNodes + nfaults);
|
|
|
|
RF_ASSERT(termNode->numSuccedents == 0);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = wndNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
|
|
|
RF_ASSERT(wndNodes->numSuccedents == 1);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[i] = tmpNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
termNode->antType[i] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpNode = tmpNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
RF_ASSERT(wnpNode->numSuccedents == 1);
|
|
|
|
wnpNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[nWndNodes] = wnpNode;
|
|
|
|
termNode->antType[nWndNodes] = rf_control;
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
|
|
|
RF_ASSERT(wnqNode->numSuccedents == 1);
|
|
|
|
wnqNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[nWndNodes + 1] = wnqNode;
|
|
|
|
termNode->antType[nWndNodes + 1] = rf_control;
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
1998-11-13 07:20:26 +03:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* creates a DAG to perform a small-write operation (either raid 5 or pq),
|
|
|
|
* which is as follows:
|
|
|
|
*
|
|
|
|
* Hdr -> Nil -> Rop -> Xor -> Cmt ----> Wnp [Unp] --> Trm
|
|
|
|
* \- Rod X / \----> Wnd [Und]-/
|
|
|
|
* [\- Rod X / \---> Wnd [Und]-/]
|
|
|
|
* [\- Roq -> Q / \--> Wnq [Unq]-/]
|
|
|
|
*
|
|
|
|
* Rop = read old parity
|
|
|
|
* Rod = read old data
|
|
|
|
* Roq = read old "q"
|
|
|
|
* Cmt = commit node
|
|
|
|
* Und = unlock data disk
|
|
|
|
* Unp = unlock parity disk
|
|
|
|
* Unq = unlock q disk
|
|
|
|
* Wnp = write new parity
|
|
|
|
* Wnd = write new data
|
|
|
|
* Wnq = write new "q"
|
|
|
|
* [ ] denotes optional segments in the graph
|
|
|
|
*
|
|
|
|
* Parameters: raidPtr - description of the physical array
|
|
|
|
* asmap - logical & physical addresses for this access
|
|
|
|
* bp - buffer ptr (holds write data)
|
1999-02-05 03:06:06 +03:00
|
|
|
* flags - general flags (e.g. disk locking)
|
1998-11-13 07:20:26 +03:00
|
|
|
* allocList - list of memory allocated in DAG creation
|
|
|
|
* pfuncs - list of parity generating functions
|
|
|
|
* qfuncs - list of q generating functions
|
|
|
|
*
|
|
|
|
* A null qfuncs indicates single fault tolerant
|
|
|
|
*****************************************************************************/
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList,
|
|
|
|
const RF_RedFuncs_t *pfuncs,
|
|
|
|
const RF_RedFuncs_t *qfuncs)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_DagNode_t *readDataNodes, *readParityNodes, *readQNodes, *termNode;
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_DagNode_t *tmpNode, *tmpreadDataNode, *tmpreadParityNode;
|
|
|
|
RF_DagNode_t *xorNodes, *qNodes, *blockNode, *commitNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_DagNode_t *writeDataNodes, *writeParityNodes, *writeQNodes;
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_DagNode_t *tmpxorNode, *tmpqNode, *tmpwriteDataNode, *tmpreadQNode;
|
|
|
|
RF_DagNode_t *tmpwriteParityNode;
|
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
|
|
|
RF_DagNode_t *tmpwriteQNode;
|
|
|
|
#endif
|
2004-01-10 02:35:59 +03:00
|
|
|
int i, j, nNodes, totalNumNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ReconUnitNum_t which_ru;
|
|
|
|
int (*func) (RF_DagNode_t *), (*undoFunc) (RF_DagNode_t *);
|
|
|
|
int (*qfunc) (RF_DagNode_t *);
|
|
|
|
int numDataNodes, numParityNodes;
|
|
|
|
RF_StripeNum_t parityStripeID;
|
|
|
|
RF_PhysDiskAddr_t *pda;
|
|
|
|
char *name, *qname;
|
|
|
|
long nfaults;
|
|
|
|
|
|
|
|
nfaults = qfuncs ? 2 : 1;
|
|
|
|
|
|
|
|
parityStripeID = rf_RaidAddressToParityStripeID(&(raidPtr->Layout),
|
|
|
|
asmap->raidAddress, &which_ru);
|
|
|
|
pda = asmap->physInfo;
|
|
|
|
numDataNodes = asmap->numStripeUnitsAccessed;
|
|
|
|
numParityNodes = (asmap->parityInfo->next) ? 2 : 1;
|
|
|
|
|
2004-03-05 06:22:05 +03:00
|
|
|
#if RF_DEBUG_DAG
|
1999-02-05 03:06:06 +03:00
|
|
|
if (rf_dagDebug) {
|
|
|
|
printf("[Creating small-write DAG]\n");
|
|
|
|
}
|
2004-03-05 06:22:05 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(numDataNodes > 0);
|
|
|
|
dag_h->creator = "SmallWriteDAG";
|
|
|
|
|
|
|
|
dag_h->numCommitNodes = 1;
|
|
|
|
dag_h->numCommits = 0;
|
|
|
|
dag_h->numSuccedents = 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DAG creation occurs in four steps:
|
|
|
|
* 1. count the number of nodes in the DAG
|
|
|
|
* 2. create the nodes
|
|
|
|
* 3. initialize the nodes
|
|
|
|
* 4. connect the nodes
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Step 1. compute number of nodes in the graph
|
|
|
|
*/
|
|
|
|
|
2004-01-06 06:27:13 +03:00
|
|
|
/* number of nodes: a read and write for each data unit a
|
|
|
|
* redundancy computation node for each parity node (nfaults *
|
|
|
|
* nparity) a read and write for each parity unit a block and
|
|
|
|
* commit node (2) a terminate node if atomic RMW an unlock
|
|
|
|
* node for each data unit, redundancy unit */
|
1999-02-05 03:06:06 +03:00
|
|
|
totalNumNodes = (2 * numDataNodes) + (nfaults * numParityNodes)
|
|
|
|
+ (nfaults * 2 * numParityNodes) + 3;
|
|
|
|
/*
|
|
|
|
* Step 2. create the nodes
|
|
|
|
*/
|
2004-03-18 19:40:05 +03:00
|
|
|
|
|
|
|
blockNode = rf_AllocDAGNode();
|
|
|
|
blockNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = blockNode;
|
|
|
|
|
|
|
|
commitNode = rf_AllocDAGNode();
|
|
|
|
commitNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = commitNode;
|
|
|
|
|
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
readDataNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
readParityNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
writeDataNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
writeParityNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
xorNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
termNode = rf_AllocDAGNode();
|
|
|
|
termNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = termNode;
|
2004-01-10 02:35:59 +03:00
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
readQNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
writeQNodes = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
qNodes = dag_h->nodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
2004-02-21 23:06:29 +03:00
|
|
|
readQNodes = writeQNodes = qNodes = NULL;
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(i == totalNumNodes);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Step 3. initialize the nodes
|
|
|
|
*/
|
|
|
|
/* initialize block node (Nil) */
|
|
|
|
nNodes = numDataNodes + (nfaults * numParityNodes);
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, nNodes, 0, 0, 0,
|
|
|
|
dag_h, "Nil", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* initialize commit node (Cmt) */
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, nNodes,
|
|
|
|
(nfaults * numParityNodes), 0, 0, dag_h, "Cmt", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* initialize terminate node (Trm) */
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc,
|
|
|
|
rf_TerminateUndoFunc, NULL, 0, nNodes, 0, 0,
|
|
|
|
dag_h, "Trm", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* initialize nodes which read old data (Rod) */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = readDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpreadDataNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskReadFunc, rf_DiskReadUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, (nfaults * numParityNodes),
|
|
|
|
1, 4, 0, dag_h, "Rod", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(pda != NULL);
|
|
|
|
/* physical disk addr desc */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode->params[0].p = pda;
|
1999-02-05 03:06:06 +03:00
|
|
|
/* buffer to hold old data */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode->params[1].p = rf_AllocBuffer(raidPtr, pda, allocList);
|
|
|
|
tmpreadDataNode->params[2].v = parityStripeID;
|
|
|
|
tmpreadDataNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
for (j = 0; j < tmpreadDataNode->numSuccedents; j++) {
|
|
|
|
tmpreadDataNode->propList[j] = NULL;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize nodes which read old parity (Rop) */
|
|
|
|
pda = asmap->parityInfo;
|
|
|
|
i = 0;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = readParityNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpreadParityNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskReadFunc, rf_DiskReadUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, numParityNodes, 1, 4, 0,
|
|
|
|
dag_h, "Rop", allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode->params[0].p = pda;
|
1999-02-05 03:06:06 +03:00
|
|
|
/* buffer to hold old parity */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode->params[1].p = rf_AllocBuffer(raidPtr, pda, allocList);
|
|
|
|
tmpreadParityNode->params[2].v = parityStripeID;
|
|
|
|
tmpreadParityNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
for (j = 0; j < tmpreadParityNode->numSuccedents; j++) {
|
|
|
|
tmpreadParityNode->propList[0] = NULL;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = tmpreadParityNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
/* initialize nodes which read old Q (Roq) */
|
|
|
|
if (nfaults == 2) {
|
|
|
|
pda = asmap->qInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadQNode = readQNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpreadQNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskReadFunc, rf_DiskReadUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, numParityNodes,
|
|
|
|
1, 4, 0, dag_h, "Roq", allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadQNode->params[0].p = pda;
|
1999-02-05 03:06:06 +03:00
|
|
|
/* buffer to hold old Q */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadQNode->params[1].p = rf_AllocBuffer(raidPtr, pda, allocList);
|
|
|
|
tmpreadQNode->params[2].v = parityStripeID;
|
|
|
|
tmpreadQNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
for (j = 0; j < tmpreadQNode->numSuccedents; j++) {
|
|
|
|
tmpreadQNode->propList[0] = NULL;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadQNode = tmpreadQNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/* initialize nodes which write new data (Wnd) */
|
|
|
|
pda = asmap->physInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode = writeDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpwriteDataNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h,
|
|
|
|
"Wnd", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
/* physical disk addr desc */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode->params[0].p = pda;
|
1999-02-05 03:06:06 +03:00
|
|
|
/* buffer holding new data to be written */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode->params[1].p = pda->bufPtr;
|
|
|
|
tmpwriteDataNode->params[2].v = parityStripeID;
|
|
|
|
tmpwriteDataNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode = tmpwriteDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize nodes which compute new parity and Q.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* We use the simple XOR func in the double-XOR case, and when
|
2004-01-06 06:27:13 +03:00
|
|
|
* we're accessing only a portion of one stripe unit. The
|
|
|
|
* distinction between the two is that the regular XOR func
|
|
|
|
* assumes that the targbuf is a full SU in size, and examines
|
|
|
|
* the pda associated with the buffer to decide where within
|
|
|
|
* the buffer to XOR the data, whereas the simple XOR func
|
|
|
|
* just XORs the data into the start of the buffer. */
|
1999-02-05 03:06:06 +03:00
|
|
|
if ((numParityNodes == 2) || ((numDataNodes == 1)
|
2004-01-06 06:27:13 +03:00
|
|
|
&& (asmap->totalSectorsAccessed <
|
|
|
|
raidPtr->Layout.sectorsPerStripeUnit))) {
|
1999-02-05 03:06:06 +03:00
|
|
|
func = pfuncs->simple;
|
|
|
|
undoFunc = rf_NullNodeUndoFunc;
|
|
|
|
name = pfuncs->SimpleName;
|
|
|
|
if (qfuncs) {
|
|
|
|
qfunc = qfuncs->simple;
|
|
|
|
qname = qfuncs->SimpleName;
|
|
|
|
} else {
|
|
|
|
qfunc = NULL;
|
|
|
|
qname = NULL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
func = pfuncs->regular;
|
|
|
|
undoFunc = rf_NullNodeUndoFunc;
|
|
|
|
name = pfuncs->RegularName;
|
|
|
|
if (qfuncs) {
|
|
|
|
qfunc = qfuncs->regular;
|
|
|
|
qname = qfuncs->RegularName;
|
|
|
|
} else {
|
|
|
|
qfunc = NULL;
|
|
|
|
qname = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Initialize the xor nodes: params are {pda,buf}
|
|
|
|
* from {Rod,Wnd,Rop} nodes, and raidPtr
|
|
|
|
*/
|
|
|
|
if (numParityNodes == 2) {
|
|
|
|
/* double-xor case */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpxorNode = xorNodes;
|
|
|
|
tmpreadDataNode = readDataNodes;
|
|
|
|
tmpreadParityNode = readParityNodes;
|
|
|
|
tmpwriteDataNode = writeDataNodes;
|
|
|
|
tmpqNode = qNodes;
|
|
|
|
tmpreadQNode = readQNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
|
|
|
/* note: no wakeup func for xor */
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpxorNode, rf_wait, RF_FALSE, func,
|
2004-01-06 06:27:13 +03:00
|
|
|
undoFunc, NULL, 1,
|
|
|
|
(numDataNodes + numParityNodes),
|
|
|
|
7, 1, dag_h, name, allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpxorNode->flags |= RF_DAGNODE_FLAG_YIELD;
|
|
|
|
tmpxorNode->params[0] = tmpreadDataNode->params[0];
|
|
|
|
tmpxorNode->params[1] = tmpreadDataNode->params[1];
|
|
|
|
tmpxorNode->params[2] = tmpreadParityNode->params[0];
|
|
|
|
tmpxorNode->params[3] = tmpreadParityNode->params[1];
|
|
|
|
tmpxorNode->params[4] = tmpwriteDataNode->params[0];
|
|
|
|
tmpxorNode->params[5] = tmpwriteDataNode->params[1];
|
|
|
|
tmpxorNode->params[6].p = raidPtr;
|
1999-02-05 03:06:06 +03:00
|
|
|
/* use old parity buf as target buf */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpxorNode->results[0] = tmpreadParityNode->params[1].p;
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
|
|
|
/* note: no wakeup func for qor */
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpqNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
qfunc, undoFunc, NULL, 1,
|
|
|
|
(numDataNodes + numParityNodes),
|
|
|
|
7, 1, dag_h, qname, allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpqNode->params[0] = tmpreadDataNode->params[0];
|
|
|
|
tmpqNode->params[1] = tmpreadDataNode->params[1];
|
|
|
|
tmpqNode->params[2] = tmpreadQNode->.params[0];
|
|
|
|
tmpqNode->params[3] = tmpreadQNode->params[1];
|
|
|
|
tmpqNode->params[4] = tmpwriteDataNode->params[0];
|
|
|
|
tmpqNode->params[5] = tmpwriteDataNode->params[1];
|
|
|
|
tmpqNode->params[6].p = raidPtr;
|
1999-02-05 03:06:06 +03:00
|
|
|
/* use old Q buf as target buf */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpqNode->results[0] = tmpreadQNode->params[1].p;
|
|
|
|
tmpqNode = tmpqNode->list_next;
|
|
|
|
tmpreadQNodes = tmpreadQNodes->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpxorNode = tmpxorNode->list_next;
|
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
|
|
|
tmpreadParityNode = tmpreadParityNode->list_next;
|
|
|
|
tmpwriteDataNode = tmpwriteDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* there is only one xor node in this case */
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(xorNodes, rf_wait, RF_FALSE, func,
|
2004-01-06 06:27:13 +03:00
|
|
|
undoFunc, NULL, 1, (numDataNodes + numParityNodes),
|
|
|
|
(2 * (numDataNodes + numDataNodes + 1) + 1), 1,
|
|
|
|
dag_h, name, allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNodes->flags |= RF_DAGNODE_FLAG_YIELD;
|
|
|
|
tmpreadDataNode = readDataNodes;
|
|
|
|
for (i = 0; i < numDataNodes; i++) { /* used to be"numDataNodes + 1" until we factored
|
|
|
|
out the "+1" into the "deal with Rop separately below */
|
|
|
|
/* set up params related to Rod nodes */
|
|
|
|
xorNodes->params[2 * i + 0] = tmpreadDataNode->params[0]; /* pda */
|
|
|
|
xorNodes->params[2 * i + 1] = tmpreadDataNode->params[1]; /* buffer ptr */
|
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
/* deal with Rop separately */
|
|
|
|
xorNodes->params[2 * numDataNodes + 0] = readParityNodes->params[0]; /* pda */
|
|
|
|
xorNodes->params[2 * numDataNodes + 1] = readParityNodes->params[1]; /* buffer ptr */
|
|
|
|
|
|
|
|
tmpwriteDataNode = writeDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
|
|
|
/* set up params related to Wnd and Wnp nodes */
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNodes->params[2 * (numDataNodes + 1 + i) + 0] = /* pda */
|
|
|
|
tmpwriteDataNode->params[0];
|
|
|
|
xorNodes->params[2 * (numDataNodes + 1 + i) + 1] = /* buffer ptr */
|
|
|
|
tmpwriteDataNode->params[1];
|
|
|
|
tmpwriteDataNode = tmpwriteDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
/* xor node needs to get at RAID information */
|
2004-03-18 19:40:05 +03:00
|
|
|
xorNodes->params[2 * (numDataNodes + numDataNodes + 1)].p = raidPtr;
|
|
|
|
xorNodes->results[0] = readParityNodes->params[1].p;
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(qNodes, rf_wait, RF_FALSE, qfunc,
|
2004-01-06 06:27:13 +03:00
|
|
|
undoFunc, NULL, 1,
|
|
|
|
(numDataNodes + numParityNodes),
|
|
|
|
(2 * (numDataNodes + numDataNodes + 1) + 1), 1,
|
|
|
|
dag_h, qname, allocList);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = readDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
|
|
|
/* set up params related to Rod */
|
2004-03-18 19:40:05 +03:00
|
|
|
qNodes->params[2 * i + 0] = tmpreadDataNode->params[0]; /* pda */
|
|
|
|
qNodes->params[2 * i + 1] = tmpreadDataNode->params[1]; /* buffer ptr */
|
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
/* and read old q */
|
2004-03-18 19:40:05 +03:00
|
|
|
qNodes->params[2 * numDataNodes + 0] = /* pda */
|
|
|
|
readQNodes->params[0];
|
|
|
|
qNodes->params[2 * numDataNodes + 1] = /* buffer ptr */
|
|
|
|
readQNodes->params[1];
|
|
|
|
tmpwriteDataNode = writeDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
|
|
|
/* set up params related to Wnd nodes */
|
2004-03-18 19:40:05 +03:00
|
|
|
qNodes->params[2 * (numDataNodes + 1 + i) + 0] = /* pda */
|
|
|
|
tmpwriteDataNode->params[0];
|
|
|
|
qNodes->params[2 * (numDataNodes + 1 + i) + 1] = /* buffer ptr */
|
|
|
|
tmpwriteDataNode->params[1];
|
|
|
|
tmpwriteDataNode = tmpwriteDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
/* xor node needs to get at RAID information */
|
2004-03-18 19:40:05 +03:00
|
|
|
qNodes->params[2 * (numDataNodes + numDataNodes + 1)].p = raidPtr;
|
|
|
|
qNodes->results[0] = readQNodes->params[1].p;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize nodes which write new parity (Wnp) */
|
|
|
|
pda = asmap->parityInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteParityNode = writeParityNodes;
|
|
|
|
tmpxorNode = xorNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpwriteParityNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h,
|
|
|
|
"Wnp", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteParityNode->params[0].p = pda; /* param 1 (bufPtr)
|
|
|
|
* filled in by xor node */
|
|
|
|
tmpwriteParityNode->params[1].p = tmpxorNode->results[0]; /* buffer pointer for
|
|
|
|
* parity write
|
|
|
|
* operation */
|
|
|
|
tmpwriteParityNode->params[2].v = parityStripeID;
|
|
|
|
tmpwriteParityNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteParityNode = tmpwriteParityNode->list_next;
|
|
|
|
tmpxorNode = tmpxorNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
/* initialize nodes which write new Q (Wnq) */
|
|
|
|
if (nfaults == 2) {
|
|
|
|
pda = asmap->qInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode = writeQNodes;
|
|
|
|
tmpqNode = qNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpwriteQNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h,
|
|
|
|
"Wnq", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode->params[0].p = pda; /* param 1 (bufPtr)
|
1999-02-05 03:06:06 +03:00
|
|
|
* filled in by xor node */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode->params[1].p = tmpqNode->results[0]; /* buffer pointer for
|
1999-02-05 03:06:06 +03:00
|
|
|
* parity write
|
|
|
|
* operation */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode->params[2].v = parityStripeID;
|
|
|
|
tmpwriteQNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY,
|
2004-01-10 03:56:27 +03:00
|
|
|
which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode = tmpwriteQNode->list_next;
|
|
|
|
tmpqNode = tmpqNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/*
|
|
|
|
* Step 4. connect the nodes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* connect header to block node */
|
|
|
|
dag_h->succedents[0] = blockNode;
|
|
|
|
|
|
|
|
/* connect block node to read old data nodes */
|
|
|
|
RF_ASSERT(blockNode->numSuccedents == (numDataNodes + (numParityNodes * nfaults)));
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = readDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
blockNode->succedents[i] = tmpreadDataNode;
|
|
|
|
RF_ASSERT(tmpreadDataNode->numAntecedents == 1);
|
|
|
|
tmpreadDataNode->antecedents[0] = blockNode;
|
|
|
|
tmpreadDataNode->antType[0] = rf_control;
|
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* connect block node to read old parity nodes */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = readParityNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
blockNode->succedents[numDataNodes + i] = tmpreadParityNode;
|
|
|
|
RF_ASSERT(tmpreadParityNode->numAntecedents == 1);
|
|
|
|
tmpreadParityNode->antecedents[0] = blockNode;
|
|
|
|
tmpreadParityNode->antType[0] = rf_control;
|
|
|
|
tmpreadParityNode = tmpreadParityNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect block node to read old Q nodes */
|
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadQNode = readQNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
blockNode->succedents[numDataNodes + numParityNodes + i] = tmpreadQNode;
|
|
|
|
RF_ASSERT(tmpreadQNode->numAntecedents == 1);
|
|
|
|
tmpreadQNode->antecedents[0] = blockNode;
|
|
|
|
tmpreadQNode->antType[0] = rf_control;
|
|
|
|
tmpreadQNode = tmpreadQNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect read old data nodes to xor nodes */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = readDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpreadDataNode->numSuccedents == (nfaults * numParityNodes));
|
|
|
|
tmpxorNode = xorNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (j = 0; j < numParityNodes; j++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpxorNode->numAntecedents == numDataNodes + numParityNodes);
|
|
|
|
tmpreadDataNode->succedents[j] = tmpxorNode;
|
|
|
|
tmpxorNode->antecedents[i] = tmpreadDataNode;
|
|
|
|
tmpxorNode->antType[i] = rf_trueData;
|
|
|
|
tmpxorNode = tmpxorNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect read old data nodes to q nodes */
|
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = readDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpqNode = qNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (j = 0; j < numParityNodes; j++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpqNode->numAntecedents == numDataNodes + numParityNodes);
|
|
|
|
tmpreadDataNode->succedents[numParityNodes + j] = tmpqNode;
|
|
|
|
tmpqNode->antecedents[i] = tmpreadDataNode;
|
|
|
|
tmpqNode->antType[i] = rf_trueData;
|
|
|
|
tmpqNode = tmpqNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadDataNode = tmpreadDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect read old parity nodes to xor nodes */
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = readParityNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpreadParityNode->numSuccedents == numParityNodes);
|
|
|
|
tmpxorNode = xorNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (j = 0; j < numParityNodes; j++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode->succedents[j] = tmpxorNode;
|
|
|
|
tmpxorNode->antecedents[numDataNodes + i] = tmpreadParityNode;
|
|
|
|
tmpxorNode->antType[numDataNodes + i] = rf_trueData;
|
|
|
|
tmpxorNode = tmpxorNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = tmpreadParityNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect read old q nodes to q nodes */
|
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = readParityNodes;
|
|
|
|
tmpreadQNode = readQNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpreadParityNode->numSuccedents == numParityNodes);
|
|
|
|
tmpqNode = qNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (j = 0; j < numParityNodes; j++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadQNode->succedents[j] = tmpqNode;
|
|
|
|
tmpqNode->antecedents[numDataNodes + i] = tmpreadQNodes;
|
|
|
|
tmpqNode->antType[numDataNodes + i] = rf_trueData;
|
|
|
|
tmpqNode = tmpqNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpreadParityNode = tmpreadParityNode->list_next;
|
|
|
|
tmpreadQNode = tmpreadQNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect xor nodes to commit node */
|
|
|
|
RF_ASSERT(commitNode->numAntecedents == (nfaults * numParityNodes));
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpxorNode = xorNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpxorNode->numSuccedents == 1);
|
|
|
|
tmpxorNode->succedents[0] = commitNode;
|
|
|
|
commitNode->antecedents[i] = tmpxorNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
commitNode->antType[i] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpxorNode = tmpxorNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect q nodes to commit node */
|
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpqNode = qNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpqNode->numSuccedents == 1);
|
|
|
|
tmpqNode->succedents[0] = commitNode;
|
|
|
|
commitNode->antecedents[i + numParityNodes] = tmpqNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
commitNode->antType[i + numParityNodes] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpqNode = tmpqNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
/* connect commit node to write nodes */
|
|
|
|
RF_ASSERT(commitNode->numSuccedents == (numDataNodes + (nfaults * numParityNodes)));
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode = writeDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwriteDataNodes->numAntecedents == 1);
|
|
|
|
commitNode->succedents[i] = tmpwriteDataNode;
|
|
|
|
tmpwriteDataNode->antecedents[0] = commitNode;
|
|
|
|
tmpwriteDataNode->antType[0] = rf_trueData;
|
|
|
|
tmpwriteDataNode = tmpwriteDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteParityNode = writeParityNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwriteParityNode->numAntecedents == 1);
|
|
|
|
commitNode->succedents[i + numDataNodes] = tmpwriteParityNode;
|
|
|
|
tmpwriteParityNode->antecedents[0] = commitNode;
|
|
|
|
tmpwriteParityNode->antType[0] = rf_trueData;
|
|
|
|
tmpwriteParityNode = tmpwriteParityNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode = writeQNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwriteQNode->numAntecedents == 1);
|
|
|
|
commitNode->succedents[i + numDataNodes + numParityNodes] = tmpwriteQNode;
|
|
|
|
tmpwriteQNode->antecedents[0] = commitNode;
|
|
|
|
tmpwriteQNode->antType[0] = rf_trueData;
|
|
|
|
tmpwriteQNode = tmpwriteQNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(termNode->numAntecedents == (numDataNodes + (nfaults * numParityNodes)));
|
|
|
|
RF_ASSERT(termNode->numSuccedents == 0);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode = writeDataNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numDataNodes; i++) {
|
2004-01-10 02:35:59 +03:00
|
|
|
/* connect write new data nodes to term node */
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwriteDataNode->numSuccedents == 1);
|
2004-01-10 02:35:59 +03:00
|
|
|
RF_ASSERT(termNode->numAntecedents == (numDataNodes + (nfaults * numParityNodes)));
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[i] = tmpwriteDataNode;
|
2004-01-10 02:35:59 +03:00
|
|
|
termNode->antType[i] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteDataNode = tmpwriteDataNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteParityNode = writeParityNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwriteParityNode->numSuccedents == 1);
|
|
|
|
tmpwriteParityNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[numDataNodes + i] = tmpwriteParityNode;
|
2004-01-10 02:35:59 +03:00
|
|
|
termNode->antType[numDataNodes + i] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteParityNode = tmpwriteParityNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
2004-03-07 02:34:27 +03:00
|
|
|
#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
|
1999-02-05 03:06:06 +03:00
|
|
|
if (nfaults == 2) {
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode = writeQNodes;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < numParityNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwriteQNode->numSuccedents == 1);
|
|
|
|
tmpwriteQNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[numDataNodes + numParityNodes + i] = tmpwriteQNode;
|
2004-01-10 02:35:59 +03:00
|
|
|
termNode->antType[numDataNodes + numParityNodes + i] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwriteQNode = tmpwriteQNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
}
|
2004-03-07 02:34:27 +03:00
|
|
|
#endif
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* create a write graph (fault-free or degraded) for RAID level 1
|
|
|
|
*
|
|
|
|
* Hdr -> Commit -> Wpd -> Nil -> Trm
|
|
|
|
* -> Wsd ->
|
|
|
|
*
|
|
|
|
* The "Wpd" node writes data to the primary copy in the mirror pair
|
|
|
|
* The "Wsd" node writes data to the secondary copy in the mirror pair
|
|
|
|
*
|
|
|
|
* Parameters: raidPtr - description of the physical array
|
|
|
|
* asmap - logical & physical addresses for this access
|
|
|
|
* bp - buffer ptr (holds write data)
|
1999-02-05 03:06:06 +03:00
|
|
|
* flags - general flags (e.g. disk locking)
|
1998-11-13 07:20:26 +03:00
|
|
|
* allocList - list of memory allocated in DAG creation
|
|
|
|
*****************************************************************************/
|
|
|
|
|
1999-02-05 03:06:06 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_CreateRaidOneWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|
|
|
RF_DagHeader_t *dag_h, void *bp,
|
|
|
|
RF_RaidAccessFlags_t flags,
|
|
|
|
RF_AllocListElem_t *allocList)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_DagNode_t *unblockNode, *termNode, *commitNode;
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_DagNode_t *wndNode, *wmirNode;
|
|
|
|
RF_DagNode_t *tmpNode, *tmpwndNode, *tmpwmirNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
int nWndNodes, nWmirNodes, i;
|
|
|
|
RF_ReconUnitNum_t which_ru;
|
|
|
|
RF_PhysDiskAddr_t *pda, *pdaP;
|
|
|
|
RF_StripeNum_t parityStripeID;
|
|
|
|
|
|
|
|
parityStripeID = rf_RaidAddressToParityStripeID(&(raidPtr->Layout),
|
|
|
|
asmap->raidAddress, &which_ru);
|
2004-03-05 06:22:05 +03:00
|
|
|
#if RF_DEBUG_DAG
|
1999-02-05 03:06:06 +03:00
|
|
|
if (rf_dagDebug) {
|
|
|
|
printf("[Creating RAID level 1 write DAG]\n");
|
|
|
|
}
|
2004-03-05 06:22:05 +03:00
|
|
|
#endif
|
1999-02-05 03:06:06 +03:00
|
|
|
dag_h->creator = "RaidOneWriteDAG";
|
|
|
|
|
|
|
|
/* 2 implies access not SU aligned */
|
|
|
|
nWmirNodes = (asmap->parityInfo->next) ? 2 : 1;
|
|
|
|
nWndNodes = (asmap->physInfo->next) ? 2 : 1;
|
|
|
|
|
|
|
|
/* alloc the Wnd nodes and the Wmir node */
|
|
|
|
if (asmap->numDataFailed == 1)
|
|
|
|
nWndNodes--;
|
|
|
|
if (asmap->numParityFailed == 1)
|
|
|
|
nWmirNodes--;
|
|
|
|
|
|
|
|
/* total number of nodes = nWndNodes + nWmirNodes + (commit + unblock
|
|
|
|
* + terminator) */
|
2004-03-18 19:40:05 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
wndNode = dag_h->nodes;
|
|
|
|
|
|
|
|
for (i = 0; i < nWmirNodes; i++) {
|
|
|
|
tmpNode = rf_AllocDAGNode();
|
|
|
|
tmpNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = tmpNode;
|
|
|
|
}
|
|
|
|
wmirNode = dag_h->nodes;
|
|
|
|
|
|
|
|
commitNode = rf_AllocDAGNode();
|
|
|
|
commitNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = commitNode;
|
|
|
|
|
|
|
|
unblockNode = rf_AllocDAGNode();
|
|
|
|
unblockNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = unblockNode;
|
|
|
|
|
|
|
|
termNode = rf_AllocDAGNode();
|
|
|
|
termNode->list_next = dag_h->nodes;
|
|
|
|
dag_h->nodes = termNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* this dag can commit immediately */
|
|
|
|
dag_h->numCommitNodes = 1;
|
|
|
|
dag_h->numCommits = 0;
|
|
|
|
dag_h->numSuccedents = 1;
|
|
|
|
|
|
|
|
/* initialize the commit, unblock, and term nodes */
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, (nWndNodes + nWmirNodes),
|
|
|
|
0, 0, 0, dag_h, "Cmt", allocList);
|
|
|
|
rf_InitNode(unblockNode, rf_wait, RF_FALSE, rf_NullNodeFunc,
|
|
|
|
rf_NullNodeUndoFunc, NULL, 1, (nWndNodes + nWmirNodes),
|
|
|
|
0, 0, dag_h, "Nil", allocList);
|
|
|
|
rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc,
|
|
|
|
rf_TerminateUndoFunc, NULL, 0, 1, 0, 0,
|
|
|
|
dag_h, "Trm", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
|
|
|
|
/* initialize the wnd nodes */
|
|
|
|
if (nWndNodes > 0) {
|
|
|
|
pda = asmap->physInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwndNode = wndNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpwndNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, 1, 1, 4, 0,
|
|
|
|
dag_h, "Wpd", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwndNode->params[0].p = pda;
|
|
|
|
tmpwndNode->params[1].p = pda->bufPtr;
|
|
|
|
tmpwndNode->params[2].v = parityStripeID;
|
|
|
|
tmpwndNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwndNode = tmpwndNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
RF_ASSERT(pda == NULL);
|
|
|
|
}
|
|
|
|
/* initialize the mirror nodes */
|
|
|
|
if (nWmirNodes > 0) {
|
|
|
|
pda = asmap->physInfo;
|
|
|
|
pdaP = asmap->parityInfo;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwmirNode = wmirNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWmirNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
rf_InitNode(tmpwmirNode, rf_wait, RF_FALSE,
|
2004-01-06 06:27:13 +03:00
|
|
|
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
|
|
|
|
rf_GenericWakeupFunc, 1, 1, 4, 0,
|
|
|
|
dag_h, "Wsd", allocList);
|
1999-02-05 03:06:06 +03:00
|
|
|
RF_ASSERT(pda != NULL);
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwmirNode->params[0].p = pdaP;
|
|
|
|
tmpwmirNode->params[1].p = pda->bufPtr;
|
|
|
|
tmpwmirNode->params[2].v = parityStripeID;
|
|
|
|
tmpwmirNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
|
1999-02-05 03:06:06 +03:00
|
|
|
pda = pda->next;
|
|
|
|
pdaP = pdaP->next;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwmirNode = tmpwmirNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
RF_ASSERT(pda == NULL);
|
|
|
|
RF_ASSERT(pdaP == NULL);
|
|
|
|
}
|
|
|
|
/* link the header node to the commit node */
|
|
|
|
RF_ASSERT(dag_h->numSuccedents == 1);
|
|
|
|
RF_ASSERT(commitNode->numAntecedents == 0);
|
|
|
|
dag_h->succedents[0] = commitNode;
|
|
|
|
|
|
|
|
/* link the commit node to the write nodes */
|
|
|
|
RF_ASSERT(commitNode->numSuccedents == (nWndNodes + nWmirNodes));
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwndNode = wndNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwndNode->numAntecedents == 1);
|
|
|
|
commitNode->succedents[i] = tmpwndNode;
|
|
|
|
tmpwndNode->antecedents[0] = commitNode;
|
|
|
|
tmpwndNode->antType[0] = rf_control;
|
|
|
|
tmpwndNode = tmpwndNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwmirNode = wmirNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWmirNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwmirNode->numAntecedents == 1);
|
|
|
|
commitNode->succedents[i + nWndNodes] = tmpwmirNode;
|
|
|
|
tmpwmirNode->antecedents[0] = commitNode;
|
|
|
|
tmpwmirNode->antType[0] = rf_control;
|
|
|
|
tmpwmirNode = tmpwmirNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* link the write nodes to the unblock node */
|
|
|
|
RF_ASSERT(unblockNode->numAntecedents == (nWndNodes + nWmirNodes));
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwndNode = wndNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWndNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwndNode->numSuccedents == 1);
|
|
|
|
tmpwndNode->succedents[0] = unblockNode;
|
|
|
|
unblockNode->antecedents[i] = tmpwndNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
unblockNode->antType[i] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwndNode = tmpwndNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwmirNode = wmirNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
for (i = 0; i < nWmirNodes; i++) {
|
2004-03-18 19:40:05 +03:00
|
|
|
RF_ASSERT(tmpwmirNode->numSuccedents == 1);
|
|
|
|
tmpwmirNode->succedents[0] = unblockNode;
|
|
|
|
unblockNode->antecedents[i + nWndNodes] = tmpwmirNode;
|
1999-02-05 03:06:06 +03:00
|
|
|
unblockNode->antType[i + nWndNodes] = rf_control;
|
2004-03-18 19:40:05 +03:00
|
|
|
tmpwmirNode = tmpwmirNode->list_next;
|
1999-02-05 03:06:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* link the unblock node to the term node */
|
|
|
|
RF_ASSERT(unblockNode->numSuccedents == 1);
|
|
|
|
RF_ASSERT(termNode->numAntecedents == 1);
|
|
|
|
RF_ASSERT(termNode->numSuccedents == 0);
|
|
|
|
unblockNode->succedents[0] = termNode;
|
|
|
|
termNode->antecedents[0] = unblockNode;
|
|
|
|
termNode->antType[0] = rf_control;
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|