Home | History | Annotate | Line # | Download | only in raidframe
rf_parityscan.c revision 1.12
      1  1.12    lukem /*	$NetBSD: rf_parityscan.c,v 1.12 2001/11/13 07:11:16 lukem 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
      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  *
     31   1.1    oster  * rf_parityscan.c -- misc utilities related to parity verification
     32   1.1    oster  *
     33   1.1    oster  *****************************************************************************/
     34  1.12    lukem 
     35  1.12    lukem #include <sys/cdefs.h>
     36  1.12    lukem __KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.12 2001/11/13 07:11:16 lukem Exp $");
     37   1.1    oster 
     38  1.11    oster #include <dev/raidframe/raidframevar.h>
     39  1.11    oster 
     40   1.1    oster #include "rf_raid.h"
     41   1.1    oster #include "rf_dag.h"
     42   1.1    oster #include "rf_dagfuncs.h"
     43   1.1    oster #include "rf_dagutils.h"
     44   1.1    oster #include "rf_mcpair.h"
     45   1.1    oster #include "rf_general.h"
     46   1.1    oster #include "rf_engine.h"
     47   1.1    oster #include "rf_parityscan.h"
     48   1.1    oster #include "rf_map.h"
     49   1.1    oster 
     50   1.1    oster /*****************************************************************************************
     51   1.1    oster  *
     52   1.1    oster  * walk through the entire arry and write new parity.
     53   1.1    oster  * This works by creating two DAGs, one to read a stripe of data and one to
     54   1.1    oster  * write new parity.  The first is executed, the data is xored together, and
     55   1.1    oster  * then the second is executed.  To avoid constantly building and tearing down
     56   1.1    oster  * the DAGs, we create them a priori and fill them in with the mapping
     57   1.1    oster  * information as we go along.
     58   1.1    oster  *
     59   1.1    oster  * there should never be more than one thread running this.
     60   1.1    oster  *
     61   1.1    oster  ****************************************************************************************/
     62   1.1    oster 
     63   1.3    oster int
     64   1.3    oster rf_RewriteParity(raidPtr)
     65   1.3    oster 	RF_Raid_t *raidPtr;
     66   1.1    oster {
     67   1.3    oster 	RF_RaidLayout_t *layoutPtr = &raidPtr->Layout;
     68   1.3    oster 	RF_AccessStripeMapHeader_t *asm_h;
     69   1.6    oster 	int ret_val;
     70   1.4    oster 	int rc;
     71   1.3    oster 	RF_PhysDiskAddr_t pda;
     72   1.3    oster 	RF_SectorNum_t i;
     73   1.5    oster 
     74   1.5    oster 	if (raidPtr->Layout.map->faultsTolerated == 0) {
     75   1.5    oster 		/* There isn't any parity. Call it "okay." */
     76   1.5    oster 		return (RF_PARITY_OKAY);
     77   1.5    oster 	}
     78   1.5    oster 	if (raidPtr->status[0] != rf_rs_optimal) {
     79   1.5    oster 		/*
     80   1.5    oster 		 * We're in degraded mode.  Don't try to verify parity now!
     81   1.5    oster 		 * XXX: this should be a "we don't want to", not a
     82   1.5    oster 		 * "we can't" error.
     83   1.5    oster 		 */
     84   1.5    oster 		return (RF_PARITY_COULD_NOT_VERIFY);
     85   1.5    oster 	}
     86   1.3    oster 
     87   1.6    oster 	ret_val = 0;
     88   1.6    oster 
     89   1.3    oster 	pda.startSector = 0;
     90   1.3    oster 	pda.numSector = raidPtr->Layout.sectorsPerStripeUnit;
     91   1.6    oster 	rc = RF_PARITY_OKAY;
     92   1.1    oster 
     93   1.6    oster 	for (i = 0; i < raidPtr->totalSectors &&
     94   1.6    oster 		     rc <= RF_PARITY_CORRECTED;
     95   1.4    oster 	     i += layoutPtr->dataSectorsPerStripe) {
     96   1.9    oster 		if (raidPtr->waitShutdown) {
     97   1.9    oster 			/* Someone is pulling the plug on this set...
     98   1.9    oster 			   abort the re-write */
     99   1.9    oster 			return (1);
    100   1.9    oster 		}
    101   1.4    oster 		asm_h = rf_MapAccess(raidPtr, i,
    102   1.4    oster 				     layoutPtr->dataSectorsPerStripe,
    103   1.4    oster 				     NULL, RF_DONT_REMAP);
    104   1.8    oster 		raidPtr->parity_rewrite_stripes_done =
    105   1.8    oster 			i / layoutPtr->dataSectorsPerStripe ;
    106   1.3    oster 		rc = rf_VerifyParity(raidPtr, asm_h->stripeMap, 1, 0);
    107   1.4    oster 
    108   1.3    oster 		switch (rc) {
    109   1.3    oster 		case RF_PARITY_OKAY:
    110   1.3    oster 		case RF_PARITY_CORRECTED:
    111   1.3    oster 			break;
    112   1.3    oster 		case RF_PARITY_BAD:
    113   1.3    oster 			printf("Parity bad during correction\n");
    114   1.6    oster 			ret_val = 1;
    115   1.3    oster 			break;
    116   1.3    oster 		case RF_PARITY_COULD_NOT_CORRECT:
    117   1.3    oster 			printf("Could not correct bad parity\n");
    118   1.6    oster 			ret_val = 1;
    119   1.3    oster 			break;
    120   1.3    oster 		case RF_PARITY_COULD_NOT_VERIFY:
    121   1.3    oster 			printf("Could not verify parity\n");
    122   1.6    oster 			ret_val = 1;
    123   1.3    oster 			break;
    124   1.3    oster 		default:
    125   1.3    oster 			printf("Bad rc=%d from VerifyParity in RewriteParity\n", rc);
    126   1.6    oster 			ret_val = 1;
    127   1.3    oster 		}
    128   1.3    oster 		rf_FreeAccessStripeMap(asm_h);
    129   1.3    oster 	}
    130   1.6    oster 	return (ret_val);
    131   1.1    oster }
    132   1.1    oster /*****************************************************************************************
    133   1.1    oster  *
    134   1.1    oster  * verify that the parity in a particular stripe is correct.
    135   1.1    oster  * we validate only the range of parity defined by parityPDA, since
    136   1.1    oster  * this is all we have locked.  The way we do this is to create an asm
    137   1.1    oster  * that maps the whole stripe and then range-restrict it to the parity
    138   1.1    oster  * region defined by the parityPDA.
    139   1.1    oster  *
    140   1.1    oster  ****************************************************************************************/
    141   1.3    oster int
    142   1.3    oster rf_VerifyParity(raidPtr, aasm, correct_it, flags)
    143   1.3    oster 	RF_Raid_t *raidPtr;
    144   1.3    oster 	RF_AccessStripeMap_t *aasm;
    145   1.3    oster 	int     correct_it;
    146   1.3    oster 	RF_RaidAccessFlags_t flags;
    147   1.1    oster {
    148   1.3    oster 	RF_PhysDiskAddr_t *parityPDA;
    149   1.3    oster 	RF_AccessStripeMap_t *doasm;
    150   1.3    oster 	RF_LayoutSW_t *lp;
    151   1.3    oster 	int     lrc, rc;
    152   1.3    oster 
    153   1.3    oster 	lp = raidPtr->Layout.map;
    154   1.3    oster 	if (lp->faultsTolerated == 0) {
    155   1.3    oster 		/*
    156   1.3    oster 	         * There isn't any parity. Call it "okay."
    157   1.3    oster 	         */
    158   1.3    oster 		return (RF_PARITY_OKAY);
    159   1.3    oster 	}
    160   1.3    oster 	rc = RF_PARITY_OKAY;
    161   1.3    oster 	if (lp->VerifyParity) {
    162   1.3    oster 		for (doasm = aasm; doasm; doasm = doasm->next) {
    163   1.4    oster 			for (parityPDA = doasm->parityInfo; parityPDA;
    164   1.4    oster 			     parityPDA = parityPDA->next) {
    165   1.4    oster 				lrc = lp->VerifyParity(raidPtr,
    166   1.4    oster 						       doasm->raidAddress,
    167   1.4    oster 						       parityPDA,
    168   1.4    oster 						       correct_it, flags);
    169   1.3    oster 				if (lrc > rc) {
    170   1.3    oster 					/* see rf_parityscan.h for why this
    171   1.3    oster 					 * works */
    172   1.3    oster 					rc = lrc;
    173   1.3    oster 				}
    174   1.3    oster 			}
    175   1.3    oster 		}
    176   1.3    oster 	} else {
    177   1.3    oster 		rc = RF_PARITY_COULD_NOT_VERIFY;
    178   1.3    oster 	}
    179   1.3    oster 	return (rc);
    180   1.1    oster }
    181   1.1    oster 
    182   1.3    oster int
    183   1.3    oster rf_VerifyParityBasic(raidPtr, raidAddr, parityPDA, correct_it, flags)
    184   1.3    oster 	RF_Raid_t *raidPtr;
    185   1.3    oster 	RF_RaidAddr_t raidAddr;
    186   1.3    oster 	RF_PhysDiskAddr_t *parityPDA;
    187   1.3    oster 	int     correct_it;
    188   1.3    oster 	RF_RaidAccessFlags_t flags;
    189   1.1    oster {
    190   1.3    oster 	RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout);
    191   1.4    oster 	RF_RaidAddr_t startAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr,
    192   1.4    oster 								     raidAddr);
    193   1.3    oster 	RF_SectorCount_t numsector = parityPDA->numSector;
    194   1.3    oster 	int     numbytes = rf_RaidAddressToByte(raidPtr, numsector);
    195   1.3    oster 	int     bytesPerStripe = numbytes * layoutPtr->numDataCol;
    196   1.3    oster 	RF_DagHeader_t *rd_dag_h, *wr_dag_h;	/* read, write dag */
    197   1.3    oster 	RF_DagNode_t *blockNode, *unblockNode, *wrBlock, *wrUnblock;
    198   1.3    oster 	RF_AccessStripeMapHeader_t *asm_h;
    199   1.3    oster 	RF_AccessStripeMap_t *asmap;
    200   1.3    oster 	RF_AllocListElem_t *alloclist;
    201   1.3    oster 	RF_PhysDiskAddr_t *pda;
    202   1.3    oster 	char   *pbuf, *buf, *end_p, *p;
    203   1.3    oster 	int     i, retcode;
    204   1.3    oster 	RF_ReconUnitNum_t which_ru;
    205   1.4    oster 	RF_StripeNum_t psID = rf_RaidAddressToParityStripeID(layoutPtr,
    206   1.4    oster 							     raidAddr,
    207   1.4    oster 							     &which_ru);
    208   1.3    oster 	int     stripeWidth = layoutPtr->numDataCol + layoutPtr->numParityCol;
    209   1.3    oster 	RF_AccTraceEntry_t tracerec;
    210   1.3    oster 	RF_MCPair_t *mcpair;
    211   1.3    oster 
    212   1.3    oster 	retcode = RF_PARITY_OKAY;
    213   1.3    oster 
    214   1.3    oster 	mcpair = rf_AllocMCPair();
    215   1.3    oster 	rf_MakeAllocList(alloclist);
    216   1.3    oster 	RF_MallocAndAdd(buf, numbytes * (layoutPtr->numDataCol + layoutPtr->numParityCol), (char *), alloclist);
    217   1.3    oster 	RF_CallocAndAdd(pbuf, 1, numbytes, (char *), alloclist);	/* use calloc to make
    218   1.3    oster 									 * sure buffer is zeroed */
    219   1.3    oster 	end_p = buf + bytesPerStripe;
    220   1.3    oster 
    221   1.3    oster 	rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, numbytes, buf, rf_DiskReadFunc, rf_DiskReadUndoFunc,
    222   1.3    oster 	    "Rod", alloclist, flags, RF_IO_NORMAL_PRIORITY);
    223   1.3    oster 	blockNode = rd_dag_h->succedents[0];
    224   1.3    oster 	unblockNode = blockNode->succedents[0]->succedents[0];
    225   1.3    oster 
    226   1.3    oster 	/* map the stripe and fill in the PDAs in the dag */
    227   1.3    oster 	asm_h = rf_MapAccess(raidPtr, startAddr, layoutPtr->dataSectorsPerStripe, buf, RF_DONT_REMAP);
    228   1.3    oster 	asmap = asm_h->stripeMap;
    229   1.3    oster 
    230   1.3    oster 	for (pda = asmap->physInfo, i = 0; i < layoutPtr->numDataCol; i++, pda = pda->next) {
    231   1.3    oster 		RF_ASSERT(pda);
    232   1.3    oster 		rf_RangeRestrictPDA(raidPtr, parityPDA, pda, 0, 1);
    233   1.3    oster 		RF_ASSERT(pda->numSector != 0);
    234   1.3    oster 		if (rf_TryToRedirectPDA(raidPtr, pda, 0))
    235   1.3    oster 			goto out;	/* no way to verify parity if disk is
    236   1.3    oster 					 * dead.  return w/ good status */
    237   1.3    oster 		blockNode->succedents[i]->params[0].p = pda;
    238   1.3    oster 		blockNode->succedents[i]->params[2].v = psID;
    239   1.3    oster 		blockNode->succedents[i]->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, which_ru);
    240   1.3    oster 	}
    241   1.3    oster 
    242   1.3    oster 	RF_ASSERT(!asmap->parityInfo->next);
    243   1.3    oster 	rf_RangeRestrictPDA(raidPtr, parityPDA, asmap->parityInfo, 0, 1);
    244   1.3    oster 	RF_ASSERT(asmap->parityInfo->numSector != 0);
    245   1.3    oster 	if (rf_TryToRedirectPDA(raidPtr, asmap->parityInfo, 1))
    246   1.3    oster 		goto out;
    247   1.3    oster 	blockNode->succedents[layoutPtr->numDataCol]->params[0].p = asmap->parityInfo;
    248   1.3    oster 
    249   1.3    oster 	/* fire off the DAG */
    250  1.10  thorpej 	memset((char *) &tracerec, 0, sizeof(tracerec));
    251   1.3    oster 	rd_dag_h->tracerec = &tracerec;
    252   1.3    oster 
    253   1.3    oster 	if (rf_verifyParityDebug) {
    254   1.3    oster 		printf("Parity verify read dag:\n");
    255   1.3    oster 		rf_PrintDAGList(rd_dag_h);
    256   1.3    oster 	}
    257   1.3    oster 	RF_LOCK_MUTEX(mcpair->mutex);
    258   1.3    oster 	mcpair->flag = 0;
    259   1.3    oster 	rf_DispatchDAG(rd_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc,
    260   1.3    oster 	    (void *) mcpair);
    261   1.3    oster 	while (!mcpair->flag)
    262   1.3    oster 		RF_WAIT_COND(mcpair->cond, mcpair->mutex);
    263   1.3    oster 	RF_UNLOCK_MUTEX(mcpair->mutex);
    264   1.3    oster 	if (rd_dag_h->status != rf_enable) {
    265   1.3    oster 		RF_ERRORMSG("Unable to verify parity:  can't read the stripe\n");
    266   1.3    oster 		retcode = RF_PARITY_COULD_NOT_VERIFY;
    267   1.3    oster 		goto out;
    268   1.3    oster 	}
    269   1.3    oster 	for (p = buf; p < end_p; p += numbytes) {
    270   1.3    oster 		rf_bxor(p, pbuf, numbytes, NULL);
    271   1.3    oster 	}
    272   1.3    oster 	for (i = 0; i < numbytes; i++) {
    273   1.1    oster #if 0
    274   1.3    oster 		if (pbuf[i] != 0 || buf[bytesPerStripe + i] != 0) {
    275   1.3    oster 			printf("Bytes: %d %d %d\n", i, pbuf[i], buf[bytesPerStripe + i]);
    276   1.3    oster 		}
    277   1.1    oster #endif
    278   1.3    oster 		if (pbuf[i] != buf[bytesPerStripe + i]) {
    279   1.3    oster 			if (!correct_it)
    280   1.3    oster 				RF_ERRORMSG3("Parity verify error: byte %d of parity is 0x%x should be 0x%x\n",
    281   1.3    oster 				    i, (u_char) buf[bytesPerStripe + i], (u_char) pbuf[i]);
    282   1.3    oster 			retcode = RF_PARITY_BAD;
    283   1.3    oster 			break;
    284   1.3    oster 		}
    285   1.3    oster 	}
    286   1.1    oster 
    287   1.3    oster 	if (retcode && correct_it) {
    288   1.3    oster 		wr_dag_h = rf_MakeSimpleDAG(raidPtr, 1, numbytes, pbuf, rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
    289   1.3    oster 		    "Wnp", alloclist, flags, RF_IO_NORMAL_PRIORITY);
    290   1.3    oster 		wrBlock = wr_dag_h->succedents[0];
    291   1.3    oster 		wrUnblock = wrBlock->succedents[0]->succedents[0];
    292   1.3    oster 		wrBlock->succedents[0]->params[0].p = asmap->parityInfo;
    293   1.3    oster 		wrBlock->succedents[0]->params[2].v = psID;
    294   1.3    oster 		wrBlock->succedents[0]->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, which_ru);
    295  1.10  thorpej 		memset((char *) &tracerec, 0, sizeof(tracerec));
    296   1.3    oster 		wr_dag_h->tracerec = &tracerec;
    297   1.3    oster 		if (rf_verifyParityDebug) {
    298   1.3    oster 			printf("Parity verify write dag:\n");
    299   1.3    oster 			rf_PrintDAGList(wr_dag_h);
    300   1.3    oster 		}
    301   1.3    oster 		RF_LOCK_MUTEX(mcpair->mutex);
    302   1.3    oster 		mcpair->flag = 0;
    303   1.3    oster 		rf_DispatchDAG(wr_dag_h, (void (*) (void *)) rf_MCPairWakeupFunc,
    304   1.3    oster 		    (void *) mcpair);
    305   1.3    oster 		while (!mcpair->flag)
    306   1.3    oster 			RF_WAIT_COND(mcpair->cond, mcpair->mutex);
    307   1.3    oster 		RF_UNLOCK_MUTEX(mcpair->mutex);
    308   1.3    oster 		if (wr_dag_h->status != rf_enable) {
    309   1.3    oster 			RF_ERRORMSG("Unable to correct parity in VerifyParity:  can't write the stripe\n");
    310   1.3    oster 			retcode = RF_PARITY_COULD_NOT_CORRECT;
    311   1.3    oster 		}
    312   1.3    oster 		rf_FreeDAG(wr_dag_h);
    313   1.3    oster 		if (retcode == RF_PARITY_BAD)
    314   1.3    oster 			retcode = RF_PARITY_CORRECTED;
    315   1.3    oster 	}
    316   1.1    oster out:
    317   1.3    oster 	rf_FreeAccessStripeMap(asm_h);
    318   1.3    oster 	rf_FreeAllocList(alloclist);
    319   1.3    oster 	rf_FreeDAG(rd_dag_h);
    320   1.3    oster 	rf_FreeMCPair(mcpair);
    321   1.3    oster 	return (retcode);
    322   1.1    oster }
    323   1.1    oster 
    324   1.3    oster int
    325   1.3    oster rf_TryToRedirectPDA(raidPtr, pda, parity)
    326   1.3    oster 	RF_Raid_t *raidPtr;
    327   1.3    oster 	RF_PhysDiskAddr_t *pda;
    328   1.3    oster 	int     parity;
    329   1.1    oster {
    330   1.3    oster 	if (raidPtr->Disks[pda->row][pda->col].status == rf_ds_reconstructing) {
    331   1.3    oster 		if (rf_CheckRUReconstructed(raidPtr->reconControl[pda->row]->reconMap, pda->startSector)) {
    332   1.3    oster 			if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
    333   1.3    oster 				RF_RowCol_t or = pda->row, oc = pda->col;
    334   1.3    oster 				RF_SectorNum_t os = pda->startSector;
    335   1.3    oster 				if (parity) {
    336   1.3    oster 					(raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP);
    337   1.3    oster 					if (rf_verifyParityDebug)
    338   1.3    oster 						printf("VerifyParity: Redir P r %d c %d sect %ld -> r %d c %d sect %ld\n",
    339   1.3    oster 						    or, oc, (long) os, pda->row, pda->col, (long) pda->startSector);
    340   1.3    oster 				} else {
    341   1.3    oster 					(raidPtr->Layout.map->MapSector) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP);
    342   1.3    oster 					if (rf_verifyParityDebug)
    343   1.3    oster 						printf("VerifyParity: Redir D r %d c %d sect %ld -> r %d c %d sect %ld\n",
    344   1.3    oster 						    or, oc, (long) os, pda->row, pda->col, (long) pda->startSector);
    345   1.3    oster 				}
    346   1.3    oster 			} else {
    347   1.3    oster 				RF_RowCol_t spRow = raidPtr->Disks[pda->row][pda->col].spareRow;
    348   1.3    oster 				RF_RowCol_t spCol = raidPtr->Disks[pda->row][pda->col].spareCol;
    349   1.3    oster 				pda->row = spRow;
    350   1.3    oster 				pda->col = spCol;
    351   1.3    oster 			}
    352   1.3    oster 		}
    353   1.3    oster 	}
    354   1.3    oster 	if (RF_DEAD_DISK(raidPtr->Disks[pda->row][pda->col].status))
    355   1.3    oster 		return (1);
    356   1.3    oster 	return (0);
    357   1.1    oster }
    358   1.1    oster /*****************************************************************************************
    359   1.1    oster  *
    360   1.1    oster  * currently a stub.
    361   1.1    oster  *
    362   1.1    oster  * takes as input an ASM describing a write operation and containing one failure, and
    363   1.1    oster  * verifies that the parity was correctly updated to reflect the write.
    364   1.1    oster  *
    365   1.1    oster  * if it's a data unit that's failed, we read the other data units in the stripe and
    366   1.1    oster  * the parity unit, XOR them together, and verify that we get the data intended for
    367   1.1    oster  * the failed disk.  Since it's easy, we also validate that the right data got written
    368   1.1    oster  * to the surviving data disks.
    369   1.1    oster  *
    370   1.1    oster  * If it's the parity that failed, there's really no validation we can do except the
    371   1.1    oster  * above verification that the right data got written to all disks.  This is because
    372   1.1    oster  * the new data intended for the failed disk is supplied in the ASM, but this is of
    373   1.1    oster  * course not the case for the new parity.
    374   1.1    oster  *
    375   1.1    oster  ****************************************************************************************/
    376   1.3    oster int
    377   1.3    oster rf_VerifyDegrModeWrite(raidPtr, asmh)
    378   1.3    oster 	RF_Raid_t *raidPtr;
    379   1.3    oster 	RF_AccessStripeMapHeader_t *asmh;
    380   1.1    oster {
    381   1.3    oster 	return (0);
    382   1.1    oster }
    383   1.1    oster /* creates a simple DAG with a header, a block-recon node at level 1,
    384   1.1    oster  * nNodes nodes at level 2, an unblock-recon node at level 3, and
    385   1.1    oster  * a terminator node at level 4.  The stripe address field in
    386   1.1    oster  * the block and unblock nodes are not touched, nor are the pda
    387   1.1    oster  * fields in the second-level nodes, so they must be filled in later.
    388   1.1    oster  *
    389   1.1    oster  * commit point is established at unblock node - this means that any
    390   1.1    oster  * failure during dag execution causes the dag to fail
    391   1.1    oster  */
    392   1.3    oster RF_DagHeader_t *
    393   1.3    oster rf_MakeSimpleDAG(raidPtr, nNodes, bytesPerSU, databuf, doFunc, undoFunc, name, alloclist, flags, priority)
    394   1.3    oster 	RF_Raid_t *raidPtr;
    395   1.3    oster 	int     nNodes;
    396   1.3    oster 	int     bytesPerSU;
    397   1.3    oster 	char   *databuf;
    398   1.3    oster 	int     (*doFunc) (RF_DagNode_t * node);
    399   1.3    oster 	int     (*undoFunc) (RF_DagNode_t * node);
    400   1.3    oster 	char   *name;		/* node names at the second level */
    401   1.3    oster 	RF_AllocListElem_t *alloclist;
    402   1.3    oster 	RF_RaidAccessFlags_t flags;
    403   1.3    oster 	int     priority;
    404   1.1    oster {
    405   1.3    oster 	RF_DagHeader_t *dag_h;
    406   1.3    oster 	RF_DagNode_t *nodes, *termNode, *blockNode, *unblockNode;
    407   1.3    oster 	int     i;
    408   1.3    oster 
    409   1.3    oster 	/* create the nodes, the block & unblock nodes, and the terminator
    410   1.3    oster 	 * node */
    411   1.3    oster 	RF_CallocAndAdd(nodes, nNodes + 3, sizeof(RF_DagNode_t), (RF_DagNode_t *), alloclist);
    412   1.3    oster 	blockNode = &nodes[nNodes];
    413   1.3    oster 	unblockNode = blockNode + 1;
    414   1.3    oster 	termNode = unblockNode + 1;
    415   1.3    oster 
    416   1.3    oster 	dag_h = rf_AllocDAGHeader();
    417   1.3    oster 	dag_h->raidPtr = (void *) raidPtr;
    418   1.3    oster 	dag_h->allocList = NULL;/* we won't use this alloc list */
    419   1.3    oster 	dag_h->status = rf_enable;
    420   1.3    oster 	dag_h->numSuccedents = 1;
    421   1.3    oster 	dag_h->creator = "SimpleDAG";
    422   1.3    oster 
    423   1.3    oster 	/* this dag can not commit until the unblock node is reached errors
    424   1.3    oster 	 * prior to the commit point imply the dag has failed */
    425   1.3    oster 	dag_h->numCommitNodes = 1;
    426   1.3    oster 	dag_h->numCommits = 0;
    427   1.3    oster 
    428   1.3    oster 	dag_h->succedents[0] = blockNode;
    429   1.3    oster 	rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc, NULL, nNodes, 0, 0, 0, dag_h, "Nil", alloclist);
    430   1.3    oster 	rf_InitNode(unblockNode, rf_wait, RF_TRUE, rf_NullNodeFunc, rf_NullNodeUndoFunc, NULL, 1, nNodes, 0, 0, dag_h, "Nil", alloclist);
    431   1.3    oster 	unblockNode->succedents[0] = termNode;
    432   1.3    oster 	for (i = 0; i < nNodes; i++) {
    433   1.3    oster 		blockNode->succedents[i] = unblockNode->antecedents[i] = &nodes[i];
    434   1.3    oster 		unblockNode->antType[i] = rf_control;
    435   1.3    oster 		rf_InitNode(&nodes[i], rf_wait, RF_FALSE, doFunc, undoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, name, alloclist);
    436   1.3    oster 		nodes[i].succedents[0] = unblockNode;
    437   1.3    oster 		nodes[i].antecedents[0] = blockNode;
    438   1.3    oster 		nodes[i].antType[0] = rf_control;
    439   1.3    oster 		nodes[i].params[1].p = (databuf + (i * bytesPerSU));
    440   1.3    oster 	}
    441   1.3    oster 	rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, dag_h, "Trm", alloclist);
    442   1.3    oster 	termNode->antecedents[0] = unblockNode;
    443   1.3    oster 	termNode->antType[0] = rf_control;
    444   1.3    oster 	return (dag_h);
    445   1.1    oster }
    446