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