Home | History | Annotate | Line # | Download | only in raidframe
rf_states.c revision 1.24
      1 /*	$NetBSD: rf_states.c,v 1.24 2004/01/01 23:35:08 oster Exp $	*/
      2 /*
      3  * Copyright (c) 1995 Carnegie-Mellon University.
      4  * All rights reserved.
      5  *
      6  * Author: Mark Holland, William V. Courtright II, Robby Findler
      7  *
      8  * Permission to use, copy, modify and distribute this software and
      9  * its documentation is hereby granted, provided that both the copyright
     10  * notice and this permission notice appear in all copies of the
     11  * software, derivative works or modified versions, and any portions
     12  * thereof, and that both notices appear in supporting documentation.
     13  *
     14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17  *
     18  * Carnegie Mellon requests users of this software to return to
     19  *
     20  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21  *  School of Computer Science
     22  *  Carnegie Mellon University
     23  *  Pittsburgh PA 15213-3890
     24  *
     25  * any improvements or extensions that they make and grant Carnegie the
     26  * rights to redistribute these changes.
     27  */
     28 
     29 #include <sys/cdefs.h>
     30 __KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.24 2004/01/01 23:35:08 oster Exp $");
     31 
     32 #include <sys/errno.h>
     33 
     34 #include "rf_archs.h"
     35 #include "rf_threadstuff.h"
     36 #include "rf_raid.h"
     37 #include "rf_dag.h"
     38 #include "rf_desc.h"
     39 #include "rf_aselect.h"
     40 #include "rf_general.h"
     41 #include "rf_states.h"
     42 #include "rf_dagutils.h"
     43 #include "rf_driver.h"
     44 #include "rf_engine.h"
     45 #include "rf_map.h"
     46 #include "rf_etimer.h"
     47 #include "rf_kintf.h"
     48 
     49 #ifndef RF_DEBUG_STATES
     50 #define RF_DEBUG_STATES 0
     51 #endif
     52 
     53 /* prototypes for some of the available states.
     54 
     55    States must:
     56 
     57      - not block.
     58 
     59      - either schedule rf_ContinueRaidAccess as a callback and return
     60        RF_TRUE, or complete all of their work and return RF_FALSE.
     61 
     62      - increment desc->state when they have finished their work.
     63 */
     64 
     65 #if RF_DEBUG_STATES
     66 static char *
     67 StateName(RF_AccessState_t state)
     68 {
     69 	switch (state) {
     70 		case rf_QuiesceState:return "QuiesceState";
     71 	case rf_MapState:
     72 		return "MapState";
     73 	case rf_LockState:
     74 		return "LockState";
     75 	case rf_CreateDAGState:
     76 		return "CreateDAGState";
     77 	case rf_ExecuteDAGState:
     78 		return "ExecuteDAGState";
     79 	case rf_ProcessDAGState:
     80 		return "ProcessDAGState";
     81 	case rf_CleanupState:
     82 		return "CleanupState";
     83 	case rf_LastState:
     84 		return "LastState";
     85 	case rf_IncrAccessesCountState:
     86 		return "IncrAccessesCountState";
     87 	case rf_DecrAccessesCountState:
     88 		return "DecrAccessesCountState";
     89 	default:
     90 		return "!!! UnnamedState !!!";
     91 	}
     92 }
     93 #endif
     94 
     95 void
     96 rf_ContinueRaidAccess(RF_RaidAccessDesc_t *desc)
     97 {
     98 	int     suspended = RF_FALSE;
     99 	int     current_state_index = desc->state;
    100 	RF_AccessState_t current_state = desc->states[current_state_index];
    101 #if RF_DEBUG_STATES
    102 	int     unit = desc->raidPtr->raidid;
    103 #endif
    104 
    105 	do {
    106 
    107 		current_state_index = desc->state;
    108 		current_state = desc->states[current_state_index];
    109 
    110 		switch (current_state) {
    111 
    112 		case rf_QuiesceState:
    113 			suspended = rf_State_Quiesce(desc);
    114 			break;
    115 		case rf_IncrAccessesCountState:
    116 			suspended = rf_State_IncrAccessCount(desc);
    117 			break;
    118 		case rf_MapState:
    119 			suspended = rf_State_Map(desc);
    120 			break;
    121 		case rf_LockState:
    122 			suspended = rf_State_Lock(desc);
    123 			break;
    124 		case rf_CreateDAGState:
    125 			suspended = rf_State_CreateDAG(desc);
    126 			break;
    127 		case rf_ExecuteDAGState:
    128 			suspended = rf_State_ExecuteDAG(desc);
    129 			break;
    130 		case rf_ProcessDAGState:
    131 			suspended = rf_State_ProcessDAG(desc);
    132 			break;
    133 		case rf_CleanupState:
    134 			suspended = rf_State_Cleanup(desc);
    135 			break;
    136 		case rf_DecrAccessesCountState:
    137 			suspended = rf_State_DecrAccessCount(desc);
    138 			break;
    139 		case rf_LastState:
    140 			suspended = rf_State_LastState(desc);
    141 			break;
    142 		}
    143 
    144 		/* after this point, we cannot dereference desc since
    145 		 * desc may have been freed. desc is only freed in
    146 		 * LastState, so if we renter this function or loop
    147 		 * back up, desc should be valid. */
    148 
    149 #if RF_DEBUG_STATES
    150 		if (rf_printStatesDebug) {
    151 			printf("raid%d: State: %-24s StateIndex: %3i desc: 0x%ld %s\n",
    152 			       unit, StateName(current_state),
    153 			       current_state_index, (long) desc,
    154 			       suspended ? "callback scheduled" : "looping");
    155 		}
    156 #endif
    157 	} while (!suspended && current_state != rf_LastState);
    158 
    159 	return;
    160 }
    161 
    162 
    163 void
    164 rf_ContinueDagAccess(RF_DagList_t *dagList)
    165 {
    166 	RF_AccTraceEntry_t *tracerec = &(dagList->desc->tracerec);
    167 	RF_RaidAccessDesc_t *desc;
    168 	RF_DagHeader_t *dag_h;
    169 	RF_Etimer_t timer;
    170 	int     i;
    171 
    172 	desc = dagList->desc;
    173 
    174 	timer = tracerec->timer;
    175 	RF_ETIMER_STOP(timer);
    176 	RF_ETIMER_EVAL(timer);
    177 	tracerec->specific.user.exec_us = RF_ETIMER_VAL_US(timer);
    178 	RF_ETIMER_START(tracerec->timer);
    179 
    180 	/* skip to dag which just finished */
    181 	dag_h = dagList->dags;
    182 	for (i = 0; i < dagList->numDagsDone; i++) {
    183 		dag_h = dag_h->next;
    184 	}
    185 
    186 	/* check to see if retry is required */
    187 	if (dag_h->status == rf_rollBackward) {
    188 		/* when a dag fails, mark desc status as bad and allow
    189 		 * all other dags in the desc to execute to
    190 		 * completion.  then, free all dags and start over */
    191 		desc->status = 1;	/* bad status */
    192 
    193 		printf("raid%d: DAG failure: %c addr 0x%lx (%ld) nblk 0x%x (%d) buf 0x%lx\n",
    194 		       desc->raidPtr->raidid, desc->type,
    195 		       (long) desc->raidAddress,
    196 		       (long) desc->raidAddress, (int) desc->numBlocks,
    197 		       (int) desc->numBlocks,
    198 		       (unsigned long) (desc->bufPtr));
    199 	}
    200 	dagList->numDagsDone++;
    201 	rf_ContinueRaidAccess(desc);
    202 }
    203 
    204 int
    205 rf_State_LastState(RF_RaidAccessDesc_t *desc)
    206 {
    207 	void    (*callbackFunc) (RF_CBParam_t) = desc->callbackFunc;
    208 	RF_CBParam_t callbackArg;
    209 
    210 	callbackArg.p = desc->callbackArg;
    211 
    212 	/*
    213 	 * If this is not an async request, wake up the caller
    214 	 */
    215 	if (desc->async_flag == 0)
    216 		wakeup(desc->bp);
    217 
    218 	/*
    219 	 * That's all the IO for this one... unbusy the 'disk'.
    220 	 */
    221 
    222 	rf_disk_unbusy(desc);
    223 
    224 	/*
    225 	 * Wakeup any requests waiting to go.
    226 	 */
    227 
    228 	RF_LOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
    229 	((RF_Raid_t *) desc->raidPtr)->openings++;
    230 	RF_UNLOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
    231 
    232 	/* wake up any pending IO */
    233 	raidstart(((RF_Raid_t *) desc->raidPtr));
    234 
    235 	/* printf("Calling biodone on 0x%x\n",desc->bp); */
    236 	biodone(desc->bp);	/* access came through ioctl */
    237 
    238 	if (callbackFunc)
    239 		callbackFunc(callbackArg);
    240 	rf_FreeRaidAccDesc(desc);
    241 
    242 	return RF_FALSE;
    243 }
    244 
    245 int
    246 rf_State_IncrAccessCount(RF_RaidAccessDesc_t *desc)
    247 {
    248 	RF_Raid_t *raidPtr;
    249 
    250 	raidPtr = desc->raidPtr;
    251 	/* Bummer. We have to do this to be 100% safe w.r.t. the increment
    252 	 * below */
    253 	RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
    254 	raidPtr->accs_in_flight++;	/* used to detect quiescence */
    255 	RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
    256 
    257 	desc->state++;
    258 	return RF_FALSE;
    259 }
    260 
    261 int
    262 rf_State_DecrAccessCount(RF_RaidAccessDesc_t *desc)
    263 {
    264 	RF_Raid_t *raidPtr;
    265 
    266 	raidPtr = desc->raidPtr;
    267 
    268 	RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
    269 	raidPtr->accs_in_flight--;
    270 	if (raidPtr->accesses_suspended && raidPtr->accs_in_flight == 0) {
    271 		rf_SignalQuiescenceLock(raidPtr);
    272 	}
    273 	rf_UpdateUserStats(raidPtr, RF_ETIMER_VAL_US(desc->timer), desc->numBlocks);
    274 	RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
    275 
    276 	desc->state++;
    277 	return RF_FALSE;
    278 }
    279 
    280 int
    281 rf_State_Quiesce(RF_RaidAccessDesc_t *desc)
    282 {
    283 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
    284 	RF_Etimer_t timer;
    285 	int     suspended = RF_FALSE;
    286 	RF_Raid_t *raidPtr;
    287 
    288 	raidPtr = desc->raidPtr;
    289 
    290 	RF_ETIMER_START(timer);
    291 	RF_ETIMER_START(desc->timer);
    292 
    293 	RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
    294 	if (raidPtr->accesses_suspended) {
    295 		RF_CallbackDesc_t *cb;
    296 		cb = rf_AllocCallbackDesc();
    297 
    298 		cb->callbackFunc = (void (*) (RF_CBParam_t)) rf_ContinueRaidAccess;
    299 		cb->callbackArg.p = (void *) desc;
    300 		cb->next = raidPtr->quiesce_wait_list;
    301 		raidPtr->quiesce_wait_list = cb;
    302 		suspended = RF_TRUE;
    303 	}
    304 	RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
    305 
    306 	RF_ETIMER_STOP(timer);
    307 	RF_ETIMER_EVAL(timer);
    308 	tracerec->specific.user.suspend_ovhd_us += RF_ETIMER_VAL_US(timer);
    309 
    310 #if RF_DEBUG_QUIESCE
    311 	if (suspended && rf_quiesceDebug)
    312 		printf("Stalling access due to quiescence lock\n");
    313 #endif
    314 	desc->state++;
    315 	return suspended;
    316 }
    317 
    318 int
    319 rf_State_Map(RF_RaidAccessDesc_t *desc)
    320 {
    321 	RF_Raid_t *raidPtr = desc->raidPtr;
    322 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
    323 	RF_Etimer_t timer;
    324 
    325 	RF_ETIMER_START(timer);
    326 
    327 	if (!(desc->asmap = rf_MapAccess(raidPtr, desc->raidAddress, desc->numBlocks,
    328 		    desc->bufPtr, RF_DONT_REMAP)))
    329 		RF_PANIC();
    330 
    331 	RF_ETIMER_STOP(timer);
    332 	RF_ETIMER_EVAL(timer);
    333 	tracerec->specific.user.map_us = RF_ETIMER_VAL_US(timer);
    334 
    335 	desc->state++;
    336 	return RF_FALSE;
    337 }
    338 
    339 int
    340 rf_State_Lock(RF_RaidAccessDesc_t *desc)
    341 {
    342 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
    343 	RF_Raid_t *raidPtr = desc->raidPtr;
    344 	RF_AccessStripeMapHeader_t *asmh = desc->asmap;
    345 	RF_AccessStripeMap_t *asm_p;
    346 	RF_Etimer_t timer;
    347 	int     suspended = RF_FALSE;
    348 
    349 	RF_ETIMER_START(timer);
    350 	if (!(raidPtr->Layout.map->flags & RF_NO_STRIPE_LOCKS)) {
    351 		RF_StripeNum_t lastStripeID = -1;
    352 
    353 		/* acquire each lock that we don't already hold */
    354 		for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) {
    355 			RF_ASSERT(RF_IO_IS_R_OR_W(desc->type));
    356 			if (!rf_suppressLocksAndLargeWrites &&
    357 			    asm_p->parityInfo &&
    358 			    !(desc->flags & RF_DAG_SUPPRESS_LOCKS) &&
    359 			    !(asm_p->flags & RF_ASM_FLAGS_LOCK_TRIED)) {
    360 				asm_p->flags |= RF_ASM_FLAGS_LOCK_TRIED;
    361 				/* locks must be acquired hierarchically */
    362 				RF_ASSERT(asm_p->stripeID > lastStripeID);
    363 				lastStripeID = asm_p->stripeID;
    364 
    365 				RF_INIT_LOCK_REQ_DESC(asm_p->lockReqDesc, desc->type,
    366 				    (void (*) (struct buf *)) rf_ContinueRaidAccess, desc, asm_p,
    367 				    raidPtr->Layout.dataSectorsPerStripe);
    368 				if (rf_AcquireStripeLock(raidPtr->lockTable, asm_p->stripeID,
    369 					&asm_p->lockReqDesc)) {
    370 					suspended = RF_TRUE;
    371 					break;
    372 				}
    373 			}
    374 			if (desc->type == RF_IO_TYPE_WRITE &&
    375 			    raidPtr->status == rf_rs_reconstructing) {
    376 				if (!(asm_p->flags & RF_ASM_FLAGS_FORCE_TRIED)) {
    377 					int     val;
    378 
    379 					asm_p->flags |= RF_ASM_FLAGS_FORCE_TRIED;
    380 					val = rf_ForceOrBlockRecon(raidPtr, asm_p,
    381 					    (void (*) (RF_Raid_t *, void *)) rf_ContinueRaidAccess, desc);
    382 					if (val == 0) {
    383 						asm_p->flags |= RF_ASM_FLAGS_RECON_BLOCKED;
    384 					} else {
    385 						suspended = RF_TRUE;
    386 						break;
    387 					}
    388 				} else {
    389 					if (rf_pssDebug) {
    390 						printf("raid%d: skipping force/block because already done, psid %ld\n",
    391 						       desc->raidPtr->raidid,
    392 						       (long) asm_p->stripeID);
    393 					}
    394 				}
    395 			} else {
    396 				if (rf_pssDebug) {
    397 					printf("raid%d: skipping force/block because not write or not under recon, psid %ld\n",
    398 					       desc->raidPtr->raidid,
    399 					       (long) asm_p->stripeID);
    400 				}
    401 			}
    402 		}
    403 
    404 		RF_ETIMER_STOP(timer);
    405 		RF_ETIMER_EVAL(timer);
    406 		tracerec->specific.user.lock_us += RF_ETIMER_VAL_US(timer);
    407 
    408 		if (suspended)
    409 			return (RF_TRUE);
    410 	}
    411 	desc->state++;
    412 	return (RF_FALSE);
    413 }
    414 /*
    415  * the following three states create, execute, and post-process dags
    416  * the error recovery unit is a single dag.
    417  * by default, SelectAlgorithm creates an array of dags, one per parity stripe
    418  * in some tricky cases, multiple dags per stripe are created
    419  *   - dags within a parity stripe are executed sequentially (arbitrary order)
    420  *   - dags for distinct parity stripes are executed concurrently
    421  *
    422  * repeat until all dags complete successfully -or- dag selection fails
    423  *
    424  * while !done
    425  *   create dag(s) (SelectAlgorithm)
    426  *   if dag
    427  *     execute dag (DispatchDAG)
    428  *     if dag successful
    429  *       done (SUCCESS)
    430  *     else
    431  *       !done (RETRY - start over with new dags)
    432  *   else
    433  *     done (FAIL)
    434  */
    435 int
    436 rf_State_CreateDAG(RF_RaidAccessDesc_t *desc)
    437 {
    438 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
    439 	RF_Etimer_t timer;
    440 	RF_DagHeader_t *dag_h;
    441 	int     i, selectStatus;
    442 
    443 	/* generate a dag for the access, and fire it off.  When the dag
    444 	 * completes, we'll get re-invoked in the next state. */
    445 	RF_ETIMER_START(timer);
    446 	/* SelectAlgorithm returns one or more dags */
    447 	selectStatus = rf_SelectAlgorithm(desc, desc->flags | RF_DAG_SUPPRESS_LOCKS);
    448 #if RF_DEBUG_VALIDATE_DAG
    449 	if (rf_printDAGsDebug)
    450 		for (i = 0; i < desc->numStripes; i++)
    451 			rf_PrintDAGList(desc->dagArray[i].dags);
    452 #endif /* RF_DEBUG_VALIDATE_DAG */
    453 	RF_ETIMER_STOP(timer);
    454 	RF_ETIMER_EVAL(timer);
    455 	/* update time to create all dags */
    456 	tracerec->specific.user.dag_create_us = RF_ETIMER_VAL_US(timer);
    457 
    458 	desc->status = 0;	/* good status */
    459 
    460 	if (selectStatus) {
    461 		/* failed to create a dag */
    462 		/* this happens when there are too many faults or incomplete
    463 		 * dag libraries */
    464 		printf("[Failed to create a DAG]\n");
    465 		RF_PANIC();
    466 	} else {
    467 		/* bind dags to desc */
    468 		for (i = 0; i < desc->numStripes; i++) {
    469 			dag_h = desc->dagArray[i].dags;
    470 			while (dag_h) {
    471 				dag_h->bp = (struct buf *) desc->bp;
    472 				dag_h->tracerec = tracerec;
    473 				dag_h = dag_h->next;
    474 			}
    475 		}
    476 		desc->flags |= RF_DAG_DISPATCH_RETURNED;
    477 		desc->state++;	/* next state should be rf_State_ExecuteDAG */
    478 	}
    479 	return RF_FALSE;
    480 }
    481 
    482 
    483 
    484 /* the access has an array of dagLists, one dagList per parity stripe.
    485  * fire the first dag in each parity stripe (dagList).
    486  * dags within a stripe (dagList) must be executed sequentially
    487  *  - this preserves atomic parity update
    488  * dags for independents parity groups (stripes) are fired concurrently */
    489 
    490 int
    491 rf_State_ExecuteDAG(RF_RaidAccessDesc_t *desc)
    492 {
    493 	int     i;
    494 	RF_DagHeader_t *dag_h;
    495 	RF_DagList_t *dagArray = desc->dagArray;
    496 
    497 	/* next state is always rf_State_ProcessDAG important to do
    498 	 * this before firing the first dag (it may finish before we
    499 	 * leave this routine) */
    500 	desc->state++;
    501 
    502 	/* sweep dag array, a stripe at a time, firing the first dag
    503 	 * in each stripe */
    504 	for (i = 0; i < desc->numStripes; i++) {
    505 		RF_ASSERT(dagArray[i].numDags > 0);
    506 		RF_ASSERT(dagArray[i].numDagsDone == 0);
    507 		RF_ASSERT(dagArray[i].numDagsFired == 0);
    508 		RF_ETIMER_START(dagArray[i].tracerec.timer);
    509 		/* fire first dag in this stripe */
    510 		dag_h = dagArray[i].dags;
    511 		RF_ASSERT(dag_h);
    512 		dagArray[i].numDagsFired++;
    513 		rf_DispatchDAG(dag_h, (void (*) (void *)) rf_ContinueDagAccess, &dagArray[i]);
    514 	}
    515 
    516 	/* the DAG will always call the callback, even if there was no
    517 	 * blocking, so we are always suspended in this state */
    518 	return RF_TRUE;
    519 }
    520 
    521 
    522 
    523 /* rf_State_ProcessDAG is entered when a dag completes.
    524  * first, check to all dags in the access have completed
    525  * if not, fire as many dags as possible */
    526 
    527 int
    528 rf_State_ProcessDAG(RF_RaidAccessDesc_t *desc)
    529 {
    530 	RF_AccessStripeMapHeader_t *asmh = desc->asmap;
    531 	RF_Raid_t *raidPtr = desc->raidPtr;
    532 	RF_DagHeader_t *dag_h;
    533 	int     i, j, done = RF_TRUE;
    534 	RF_DagList_t *dagArray = desc->dagArray;
    535 	RF_Etimer_t timer;
    536 
    537 	/* check to see if this is the last dag */
    538 	for (i = 0; i < desc->numStripes; i++)
    539 		if (dagArray[i].numDags != dagArray[i].numDagsDone)
    540 			done = RF_FALSE;
    541 
    542 	if (done) {
    543 		if (desc->status) {
    544 			/* a dag failed, retry */
    545 			RF_ETIMER_START(timer);
    546 			/* free all dags */
    547 			for (i = 0; i < desc->numStripes; i++) {
    548 				rf_FreeDAG(desc->dagArray[i].dags);
    549 			}
    550 			rf_MarkFailuresInASMList(raidPtr, asmh);
    551 			/* back up to rf_State_CreateDAG */
    552 			desc->state = desc->state - 2;
    553 			return RF_FALSE;
    554 		} else {
    555 			/* move on to rf_State_Cleanup */
    556 			desc->state++;
    557 		}
    558 		return RF_FALSE;
    559 	} else {
    560 		/* more dags to execute */
    561 		/* see if any are ready to be fired.  if so, fire them */
    562 		/* don't fire the initial dag in a list, it's fired in
    563 		 * rf_State_ExecuteDAG */
    564 		for (i = 0; i < desc->numStripes; i++) {
    565 			if ((dagArray[i].numDagsDone < dagArray[i].numDags)
    566 			    && (dagArray[i].numDagsDone == dagArray[i].numDagsFired)
    567 			    && (dagArray[i].numDagsFired > 0)) {
    568 				RF_ETIMER_START(dagArray[i].tracerec.timer);
    569 				/* fire next dag in this stripe */
    570 				/* first, skip to next dag awaiting execution */
    571 				dag_h = dagArray[i].dags;
    572 				for (j = 0; j < dagArray[i].numDagsDone; j++)
    573 					dag_h = dag_h->next;
    574 				dagArray[i].numDagsFired++;
    575 				rf_DispatchDAG(dag_h, (void (*) (void *)) rf_ContinueDagAccess,
    576 				    &dagArray[i]);
    577 			}
    578 		}
    579 		return RF_TRUE;
    580 	}
    581 }
    582 /* only make it this far if all dags complete successfully */
    583 int
    584 rf_State_Cleanup(RF_RaidAccessDesc_t *desc)
    585 {
    586 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
    587 	RF_AccessStripeMapHeader_t *asmh = desc->asmap;
    588 	RF_Raid_t *raidPtr = desc->raidPtr;
    589 	RF_AccessStripeMap_t *asm_p;
    590 	RF_Etimer_t timer;
    591 	int i;
    592 
    593 	desc->state++;
    594 
    595 	timer = tracerec->timer;
    596 	RF_ETIMER_STOP(timer);
    597 	RF_ETIMER_EVAL(timer);
    598 	tracerec->specific.user.dag_retry_us = RF_ETIMER_VAL_US(timer);
    599 
    600 	/* the RAID I/O is complete.  Clean up. */
    601 	tracerec->specific.user.dag_retry_us = 0;
    602 
    603 	RF_ETIMER_START(timer);
    604 	/* free all dags */
    605 	for (i = 0; i < desc->numStripes; i++) {
    606 		rf_FreeDAG(desc->dagArray[i].dags);
    607 	}
    608 	RF_ETIMER_STOP(timer);
    609 	RF_ETIMER_EVAL(timer);
    610 	tracerec->specific.user.cleanup_us = RF_ETIMER_VAL_US(timer);
    611 
    612 	RF_ETIMER_START(timer);
    613 	if (!(raidPtr->Layout.map->flags & RF_NO_STRIPE_LOCKS)) {
    614 		for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) {
    615 			if (!rf_suppressLocksAndLargeWrites &&
    616 			    asm_p->parityInfo &&
    617 			    !(desc->flags & RF_DAG_SUPPRESS_LOCKS)) {
    618 				RF_ASSERT_VALID_LOCKREQ(&asm_p->lockReqDesc);
    619 				rf_ReleaseStripeLock(raidPtr->lockTable,
    620 						     asm_p->stripeID,
    621 						     &asm_p->lockReqDesc);
    622 			}
    623 			if (asm_p->flags & RF_ASM_FLAGS_RECON_BLOCKED) {
    624 				rf_UnblockRecon(raidPtr, asm_p);
    625 			}
    626 		}
    627 	}
    628 	RF_ETIMER_STOP(timer);
    629 	RF_ETIMER_EVAL(timer);
    630 	tracerec->specific.user.lock_us += RF_ETIMER_VAL_US(timer);
    631 
    632 	RF_ETIMER_START(timer);
    633 	rf_FreeAccessStripeMap(asmh);
    634 	RF_ETIMER_STOP(timer);
    635 	RF_ETIMER_EVAL(timer);
    636 	tracerec->specific.user.cleanup_us += RF_ETIMER_VAL_US(timer);
    637 
    638 	RF_ETIMER_STOP(desc->timer);
    639 	RF_ETIMER_EVAL(desc->timer);
    640 
    641 	timer = desc->tracerec.tot_timer;
    642 	RF_ETIMER_STOP(timer);
    643 	RF_ETIMER_EVAL(timer);
    644 	desc->tracerec.total_us = RF_ETIMER_VAL_US(timer);
    645 
    646 	rf_LogTraceRec(raidPtr, tracerec);
    647 
    648 	desc->flags |= RF_DAG_ACCESS_COMPLETE;
    649 
    650 	return RF_FALSE;
    651 }
    652