xref: /netbsd-src/sys/dev/raidframe/rf_states.c (revision d20841bb642898112fe68f0ad3f7b26dddf56f07)
1 /*	$NetBSD: rf_states.c,v 1.25 2004/01/02 21:41: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@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.25 2004/01/02 21:41: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 #if 0
193 		printf("raid%d: DAG failure: %c addr 0x%lx "
194 		       "(%ld) nblk 0x%x (%d) buf 0x%lx state %d\n",
195 		       desc->raidPtr->raidid, desc->type,
196 		       (long) desc->raidAddress,
197 		       (long) desc->raidAddress, (int) desc->numBlocks,
198 		       (int) desc->numBlocks,
199 		       (unsigned long) (desc->bufPtr), desc->state);
200 #endif
201 	}
202 	dagList->numDagsDone++;
203 	rf_ContinueRaidAccess(desc);
204 }
205 
206 int
207 rf_State_LastState(RF_RaidAccessDesc_t *desc)
208 {
209 	void    (*callbackFunc) (RF_CBParam_t) = desc->callbackFunc;
210 	RF_CBParam_t callbackArg;
211 
212 	callbackArg.p = desc->callbackArg;
213 
214 	/*
215 	 * If this is not an async request, wake up the caller
216 	 */
217 	if (desc->async_flag == 0)
218 		wakeup(desc->bp);
219 
220 	/*
221 	 * That's all the IO for this one... unbusy the 'disk'.
222 	 */
223 
224 	rf_disk_unbusy(desc);
225 
226 	/*
227 	 * Wakeup any requests waiting to go.
228 	 */
229 
230 	RF_LOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
231 	((RF_Raid_t *) desc->raidPtr)->openings++;
232 	RF_UNLOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
233 
234 	/* wake up any pending IO */
235 	raidstart(((RF_Raid_t *) desc->raidPtr));
236 
237 	/* printf("Calling biodone on 0x%x\n",desc->bp); */
238 	biodone(desc->bp);	/* access came through ioctl */
239 
240 	if (callbackFunc)
241 		callbackFunc(callbackArg);
242 	rf_FreeRaidAccDesc(desc);
243 
244 	return RF_FALSE;
245 }
246 
247 int
248 rf_State_IncrAccessCount(RF_RaidAccessDesc_t *desc)
249 {
250 	RF_Raid_t *raidPtr;
251 
252 	raidPtr = desc->raidPtr;
253 	/* Bummer. We have to do this to be 100% safe w.r.t. the increment
254 	 * below */
255 	RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
256 	raidPtr->accs_in_flight++;	/* used to detect quiescence */
257 	RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
258 
259 	desc->state++;
260 	return RF_FALSE;
261 }
262 
263 int
264 rf_State_DecrAccessCount(RF_RaidAccessDesc_t *desc)
265 {
266 	RF_Raid_t *raidPtr;
267 
268 	raidPtr = desc->raidPtr;
269 
270 	RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
271 	raidPtr->accs_in_flight--;
272 	if (raidPtr->accesses_suspended && raidPtr->accs_in_flight == 0) {
273 		rf_SignalQuiescenceLock(raidPtr);
274 	}
275 	rf_UpdateUserStats(raidPtr, RF_ETIMER_VAL_US(desc->timer), desc->numBlocks);
276 	RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
277 
278 	desc->state++;
279 	return RF_FALSE;
280 }
281 
282 int
283 rf_State_Quiesce(RF_RaidAccessDesc_t *desc)
284 {
285 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
286 	RF_Etimer_t timer;
287 	int     suspended = RF_FALSE;
288 	RF_Raid_t *raidPtr;
289 
290 	raidPtr = desc->raidPtr;
291 
292 	RF_ETIMER_START(timer);
293 	RF_ETIMER_START(desc->timer);
294 
295 	RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
296 	if (raidPtr->accesses_suspended) {
297 		RF_CallbackDesc_t *cb;
298 		cb = rf_AllocCallbackDesc();
299 
300 		cb->callbackFunc = (void (*) (RF_CBParam_t)) rf_ContinueRaidAccess;
301 		cb->callbackArg.p = (void *) desc;
302 		cb->next = raidPtr->quiesce_wait_list;
303 		raidPtr->quiesce_wait_list = cb;
304 		suspended = RF_TRUE;
305 	}
306 	RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
307 
308 	RF_ETIMER_STOP(timer);
309 	RF_ETIMER_EVAL(timer);
310 	tracerec->specific.user.suspend_ovhd_us += RF_ETIMER_VAL_US(timer);
311 
312 #if RF_DEBUG_QUIESCE
313 	if (suspended && rf_quiesceDebug)
314 		printf("Stalling access due to quiescence lock\n");
315 #endif
316 	desc->state++;
317 	return suspended;
318 }
319 
320 int
321 rf_State_Map(RF_RaidAccessDesc_t *desc)
322 {
323 	RF_Raid_t *raidPtr = desc->raidPtr;
324 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
325 	RF_Etimer_t timer;
326 
327 	RF_ETIMER_START(timer);
328 
329 	if (!(desc->asmap = rf_MapAccess(raidPtr, desc->raidAddress, desc->numBlocks,
330 		    desc->bufPtr, RF_DONT_REMAP)))
331 		RF_PANIC();
332 
333 	RF_ETIMER_STOP(timer);
334 	RF_ETIMER_EVAL(timer);
335 	tracerec->specific.user.map_us = RF_ETIMER_VAL_US(timer);
336 
337 	desc->state++;
338 	return RF_FALSE;
339 }
340 
341 int
342 rf_State_Lock(RF_RaidAccessDesc_t *desc)
343 {
344 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
345 	RF_Raid_t *raidPtr = desc->raidPtr;
346 	RF_AccessStripeMapHeader_t *asmh = desc->asmap;
347 	RF_AccessStripeMap_t *asm_p;
348 	RF_Etimer_t timer;
349 	int     suspended = RF_FALSE;
350 
351 	RF_ETIMER_START(timer);
352 	if (!(raidPtr->Layout.map->flags & RF_NO_STRIPE_LOCKS)) {
353 		RF_StripeNum_t lastStripeID = -1;
354 
355 		/* acquire each lock that we don't already hold */
356 		for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) {
357 			RF_ASSERT(RF_IO_IS_R_OR_W(desc->type));
358 			if (!rf_suppressLocksAndLargeWrites &&
359 			    asm_p->parityInfo &&
360 			    !(desc->flags & RF_DAG_SUPPRESS_LOCKS) &&
361 			    !(asm_p->flags & RF_ASM_FLAGS_LOCK_TRIED)) {
362 				asm_p->flags |= RF_ASM_FLAGS_LOCK_TRIED;
363 				/* locks must be acquired hierarchically */
364 				RF_ASSERT(asm_p->stripeID > lastStripeID);
365 				lastStripeID = asm_p->stripeID;
366 
367 				RF_INIT_LOCK_REQ_DESC(asm_p->lockReqDesc, desc->type,
368 				    (void (*) (struct buf *)) rf_ContinueRaidAccess, desc, asm_p,
369 				    raidPtr->Layout.dataSectorsPerStripe);
370 				if (rf_AcquireStripeLock(raidPtr->lockTable, asm_p->stripeID,
371 					&asm_p->lockReqDesc)) {
372 					suspended = RF_TRUE;
373 					break;
374 				}
375 			}
376 			if (desc->type == RF_IO_TYPE_WRITE &&
377 			    raidPtr->status == rf_rs_reconstructing) {
378 				if (!(asm_p->flags & RF_ASM_FLAGS_FORCE_TRIED)) {
379 					int     val;
380 
381 					asm_p->flags |= RF_ASM_FLAGS_FORCE_TRIED;
382 					val = rf_ForceOrBlockRecon(raidPtr, asm_p,
383 					    (void (*) (RF_Raid_t *, void *)) rf_ContinueRaidAccess, desc);
384 					if (val == 0) {
385 						asm_p->flags |= RF_ASM_FLAGS_RECON_BLOCKED;
386 					} else {
387 						suspended = RF_TRUE;
388 						break;
389 					}
390 				} else {
391 					if (rf_pssDebug) {
392 						printf("raid%d: skipping force/block because already done, psid %ld\n",
393 						       desc->raidPtr->raidid,
394 						       (long) asm_p->stripeID);
395 					}
396 				}
397 			} else {
398 				if (rf_pssDebug) {
399 					printf("raid%d: skipping force/block because not write or not under recon, psid %ld\n",
400 					       desc->raidPtr->raidid,
401 					       (long) asm_p->stripeID);
402 				}
403 			}
404 		}
405 
406 		RF_ETIMER_STOP(timer);
407 		RF_ETIMER_EVAL(timer);
408 		tracerec->specific.user.lock_us += RF_ETIMER_VAL_US(timer);
409 
410 		if (suspended)
411 			return (RF_TRUE);
412 	}
413 	desc->state++;
414 	return (RF_FALSE);
415 }
416 /*
417  * the following three states create, execute, and post-process dags
418  * the error recovery unit is a single dag.
419  * by default, SelectAlgorithm creates an array of dags, one per parity stripe
420  * in some tricky cases, multiple dags per stripe are created
421  *   - dags within a parity stripe are executed sequentially (arbitrary order)
422  *   - dags for distinct parity stripes are executed concurrently
423  *
424  * repeat until all dags complete successfully -or- dag selection fails
425  *
426  * while !done
427  *   create dag(s) (SelectAlgorithm)
428  *   if dag
429  *     execute dag (DispatchDAG)
430  *     if dag successful
431  *       done (SUCCESS)
432  *     else
433  *       !done (RETRY - start over with new dags)
434  *   else
435  *     done (FAIL)
436  */
437 int
438 rf_State_CreateDAG(RF_RaidAccessDesc_t *desc)
439 {
440 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
441 	RF_Etimer_t timer;
442 	RF_DagHeader_t *dag_h;
443 	struct buf *bp;
444 	int     i, selectStatus;
445 
446 	/* generate a dag for the access, and fire it off.  When the dag
447 	 * completes, we'll get re-invoked in the next state. */
448 	RF_ETIMER_START(timer);
449 	/* SelectAlgorithm returns one or more dags */
450 	selectStatus = rf_SelectAlgorithm(desc, desc->flags | RF_DAG_SUPPRESS_LOCKS);
451 #if RF_DEBUG_VALIDATE_DAG
452 	if (rf_printDAGsDebug)
453 		for (i = 0; i < desc->numStripes; i++)
454 			rf_PrintDAGList(desc->dagArray[i].dags);
455 #endif /* RF_DEBUG_VALIDATE_DAG */
456 	RF_ETIMER_STOP(timer);
457 	RF_ETIMER_EVAL(timer);
458 	/* update time to create all dags */
459 	tracerec->specific.user.dag_create_us = RF_ETIMER_VAL_US(timer);
460 
461 	desc->status = 0;	/* good status */
462 
463 	if (selectStatus) {
464 		/* failed to create a dag */
465 		/* this happens when there are too many faults or incomplete
466 		 * dag libraries */
467 		printf("raid%d: failed to create a dag. "
468 		       "Too many component failures.\n",
469 		       desc->raidPtr->raidid);
470 
471 		desc->status = 1; /* bad status */
472 		/* skip straight to rf_State_Cleanup() */
473 		desc->state = rf_CleanupState;
474 		bp = (struct buf *)desc->bp;
475 		bp->b_flags |= B_ERROR;
476 		bp->b_error = EIO;
477 	} else {
478 		/* bind dags to desc */
479 		for (i = 0; i < desc->numStripes; i++) {
480 			dag_h = desc->dagArray[i].dags;
481 			while (dag_h) {
482 				dag_h->bp = (struct buf *) desc->bp;
483 				dag_h->tracerec = tracerec;
484 				dag_h = dag_h->next;
485 			}
486 		}
487 		desc->flags |= RF_DAG_DISPATCH_RETURNED;
488 		desc->state++;	/* next state should be rf_State_ExecuteDAG */
489 	}
490 	return RF_FALSE;
491 }
492 
493 
494 
495 /* the access has an array of dagLists, one dagList per parity stripe.
496  * fire the first dag in each parity stripe (dagList).
497  * dags within a stripe (dagList) must be executed sequentially
498  *  - this preserves atomic parity update
499  * dags for independents parity groups (stripes) are fired concurrently */
500 
501 int
502 rf_State_ExecuteDAG(RF_RaidAccessDesc_t *desc)
503 {
504 	int     i;
505 	RF_DagHeader_t *dag_h;
506 	RF_DagList_t *dagArray = desc->dagArray;
507 
508 	/* next state is always rf_State_ProcessDAG important to do
509 	 * this before firing the first dag (it may finish before we
510 	 * leave this routine) */
511 	desc->state++;
512 
513 	/* sweep dag array, a stripe at a time, firing the first dag
514 	 * in each stripe */
515 	for (i = 0; i < desc->numStripes; i++) {
516 		RF_ASSERT(dagArray[i].numDags > 0);
517 		RF_ASSERT(dagArray[i].numDagsDone == 0);
518 		RF_ASSERT(dagArray[i].numDagsFired == 0);
519 		RF_ETIMER_START(dagArray[i].tracerec.timer);
520 		/* fire first dag in this stripe */
521 		dag_h = dagArray[i].dags;
522 		RF_ASSERT(dag_h);
523 		dagArray[i].numDagsFired++;
524 		rf_DispatchDAG(dag_h, (void (*) (void *)) rf_ContinueDagAccess, &dagArray[i]);
525 	}
526 
527 	/* the DAG will always call the callback, even if there was no
528 	 * blocking, so we are always suspended in this state */
529 	return RF_TRUE;
530 }
531 
532 
533 
534 /* rf_State_ProcessDAG is entered when a dag completes.
535  * first, check to all dags in the access have completed
536  * if not, fire as many dags as possible */
537 
538 int
539 rf_State_ProcessDAG(RF_RaidAccessDesc_t *desc)
540 {
541 	RF_AccessStripeMapHeader_t *asmh = desc->asmap;
542 	RF_Raid_t *raidPtr = desc->raidPtr;
543 	RF_DagHeader_t *dag_h;
544 	int     i, j, done = RF_TRUE;
545 	RF_DagList_t *dagArray = desc->dagArray;
546 	RF_Etimer_t timer;
547 
548 	/* check to see if this is the last dag */
549 	for (i = 0; i < desc->numStripes; i++)
550 		if (dagArray[i].numDags != dagArray[i].numDagsDone)
551 			done = RF_FALSE;
552 
553 	if (done) {
554 		if (desc->status) {
555 			/* a dag failed, retry */
556 			RF_ETIMER_START(timer);
557 			/* free all dags */
558 			for (i = 0; i < desc->numStripes; i++) {
559 				rf_FreeDAG(desc->dagArray[i].dags);
560 			}
561 			rf_MarkFailuresInASMList(raidPtr, asmh);
562 			/* back up to rf_State_CreateDAG */
563 			desc->state = desc->state - 2;
564 			return RF_FALSE;
565 		} else {
566 			/* move on to rf_State_Cleanup */
567 			desc->state++;
568 		}
569 		return RF_FALSE;
570 	} else {
571 		/* more dags to execute */
572 		/* see if any are ready to be fired.  if so, fire them */
573 		/* don't fire the initial dag in a list, it's fired in
574 		 * rf_State_ExecuteDAG */
575 		for (i = 0; i < desc->numStripes; i++) {
576 			if ((dagArray[i].numDagsDone < dagArray[i].numDags)
577 			    && (dagArray[i].numDagsDone == dagArray[i].numDagsFired)
578 			    && (dagArray[i].numDagsFired > 0)) {
579 				RF_ETIMER_START(dagArray[i].tracerec.timer);
580 				/* fire next dag in this stripe */
581 				/* first, skip to next dag awaiting execution */
582 				dag_h = dagArray[i].dags;
583 				for (j = 0; j < dagArray[i].numDagsDone; j++)
584 					dag_h = dag_h->next;
585 				dagArray[i].numDagsFired++;
586 				rf_DispatchDAG(dag_h, (void (*) (void *)) rf_ContinueDagAccess,
587 				    &dagArray[i]);
588 			}
589 		}
590 		return RF_TRUE;
591 	}
592 }
593 /* only make it this far if all dags complete successfully */
594 int
595 rf_State_Cleanup(RF_RaidAccessDesc_t *desc)
596 {
597 	RF_AccTraceEntry_t *tracerec = &desc->tracerec;
598 	RF_AccessStripeMapHeader_t *asmh = desc->asmap;
599 	RF_Raid_t *raidPtr = desc->raidPtr;
600 	RF_AccessStripeMap_t *asm_p;
601 	RF_Etimer_t timer;
602 	int i;
603 
604 	desc->state++;
605 
606 	timer = tracerec->timer;
607 	RF_ETIMER_STOP(timer);
608 	RF_ETIMER_EVAL(timer);
609 	tracerec->specific.user.dag_retry_us = RF_ETIMER_VAL_US(timer);
610 
611 	/* the RAID I/O is complete.  Clean up. */
612 	tracerec->specific.user.dag_retry_us = 0;
613 
614 	RF_ETIMER_START(timer);
615 	/* free all dags */
616 	for (i = 0; i < desc->numStripes; i++) {
617 		rf_FreeDAG(desc->dagArray[i].dags);
618 	}
619 	RF_ETIMER_STOP(timer);
620 	RF_ETIMER_EVAL(timer);
621 	tracerec->specific.user.cleanup_us = RF_ETIMER_VAL_US(timer);
622 
623 	RF_ETIMER_START(timer);
624 	if (!(raidPtr->Layout.map->flags & RF_NO_STRIPE_LOCKS)) {
625 		for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) {
626 			if (!rf_suppressLocksAndLargeWrites &&
627 			    asm_p->parityInfo &&
628 			    !(desc->flags & RF_DAG_SUPPRESS_LOCKS)) {
629 				RF_ASSERT_VALID_LOCKREQ(&asm_p->lockReqDesc);
630 				rf_ReleaseStripeLock(raidPtr->lockTable,
631 						     asm_p->stripeID,
632 						     &asm_p->lockReqDesc);
633 			}
634 			if (asm_p->flags & RF_ASM_FLAGS_RECON_BLOCKED) {
635 				rf_UnblockRecon(raidPtr, asm_p);
636 			}
637 		}
638 	}
639 	RF_ETIMER_STOP(timer);
640 	RF_ETIMER_EVAL(timer);
641 	tracerec->specific.user.lock_us += RF_ETIMER_VAL_US(timer);
642 
643 	RF_ETIMER_START(timer);
644 	rf_FreeAccessStripeMap(asmh);
645 	RF_ETIMER_STOP(timer);
646 	RF_ETIMER_EVAL(timer);
647 	tracerec->specific.user.cleanup_us += RF_ETIMER_VAL_US(timer);
648 
649 	RF_ETIMER_STOP(desc->timer);
650 	RF_ETIMER_EVAL(desc->timer);
651 
652 	timer = desc->tracerec.tot_timer;
653 	RF_ETIMER_STOP(timer);
654 	RF_ETIMER_EVAL(timer);
655 	desc->tracerec.total_us = RF_ETIMER_VAL_US(timer);
656 
657 	rf_LogTraceRec(raidPtr, tracerec);
658 
659 	desc->flags |= RF_DAG_ACCESS_COMPLETE;
660 
661 	return RF_FALSE;
662 }
663