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