Don't use .Xo/.Xc. Fix date format.
[netbsd-mini2440.git] / sys / dev / raidframe / rf_states.c
blob9c00bf6a92ed05c3651f41f0574771eba652486b
1 /* $NetBSD: rf_states.c,v 1.43 2008/05/20 00:29:54 oster Exp $ */
2 /*
3 * Copyright (c) 1995 Carnegie-Mellon University.
4 * All rights reserved.
6 * Author: Mark Holland, William V. Courtright II, Robby Findler
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.
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.
18 * Carnegie Mellon requests users of this software to return to
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes.
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.43 2008/05/20 00:29:54 oster Exp $");
32 #include <sys/errno.h>
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 #include "rf_paritymap.h"
50 #ifndef RF_DEBUG_STATES
51 #define RF_DEBUG_STATES 0
52 #endif
54 /* prototypes for some of the available states.
56 States must:
58 - not block.
60 - either schedule rf_ContinueRaidAccess as a callback and return
61 RF_TRUE, or complete all of their work and return RF_FALSE.
63 - increment desc->state when they have finished their work.
66 #if RF_DEBUG_STATES
67 static char *
68 StateName(RF_AccessState_t state)
70 switch (state) {
71 case rf_QuiesceState:return "QuiesceState";
72 case rf_MapState:
73 return "MapState";
74 case rf_LockState:
75 return "LockState";
76 case rf_CreateDAGState:
77 return "CreateDAGState";
78 case rf_ExecuteDAGState:
79 return "ExecuteDAGState";
80 case rf_ProcessDAGState:
81 return "ProcessDAGState";
82 case rf_CleanupState:
83 return "CleanupState";
84 case rf_LastState:
85 return "LastState";
86 case rf_IncrAccessesCountState:
87 return "IncrAccessesCountState";
88 case rf_DecrAccessesCountState:
89 return "DecrAccessesCountState";
90 default:
91 return "!!! UnnamedState !!!";
94 #endif
96 void
97 rf_ContinueRaidAccess(RF_RaidAccessDesc_t *desc)
99 int suspended = RF_FALSE;
100 int current_state_index = desc->state;
101 RF_AccessState_t current_state = desc->states[current_state_index];
102 #if RF_DEBUG_STATES
103 int unit = desc->raidPtr->raidid;
104 #endif
106 do {
108 current_state_index = desc->state;
109 current_state = desc->states[current_state_index];
111 switch (current_state) {
113 case rf_QuiesceState:
114 suspended = rf_State_Quiesce(desc);
115 break;
116 case rf_IncrAccessesCountState:
117 suspended = rf_State_IncrAccessCount(desc);
118 break;
119 case rf_MapState:
120 suspended = rf_State_Map(desc);
121 break;
122 case rf_LockState:
123 suspended = rf_State_Lock(desc);
124 break;
125 case rf_CreateDAGState:
126 suspended = rf_State_CreateDAG(desc);
127 break;
128 case rf_ExecuteDAGState:
129 suspended = rf_State_ExecuteDAG(desc);
130 break;
131 case rf_ProcessDAGState:
132 suspended = rf_State_ProcessDAG(desc);
133 break;
134 case rf_CleanupState:
135 suspended = rf_State_Cleanup(desc);
136 break;
137 case rf_DecrAccessesCountState:
138 suspended = rf_State_DecrAccessCount(desc);
139 break;
140 case rf_LastState:
141 suspended = rf_State_LastState(desc);
142 break;
145 /* after this point, we cannot dereference desc since
146 * desc may have been freed. desc is only freed in
147 * LastState, so if we renter this function or loop
148 * back up, desc should be valid. */
150 #if RF_DEBUG_STATES
151 if (rf_printStatesDebug) {
152 printf("raid%d: State: %-24s StateIndex: %3i desc: 0x%ld %s\n",
153 unit, StateName(current_state),
154 current_state_index, (long) desc,
155 suspended ? "callback scheduled" : "looping");
157 #endif
158 } while (!suspended && current_state != rf_LastState);
160 return;
164 void
165 rf_ContinueDagAccess(RF_DagList_t *dagList)
167 #if RF_ACC_TRACE > 0
168 RF_AccTraceEntry_t *tracerec = &(dagList->desc->tracerec);
169 RF_Etimer_t timer;
170 #endif
171 RF_RaidAccessDesc_t *desc;
172 RF_DagHeader_t *dag_h;
173 int i;
175 desc = dagList->desc;
177 #if RF_ACC_TRACE > 0
178 timer = tracerec->timer;
179 RF_ETIMER_STOP(timer);
180 RF_ETIMER_EVAL(timer);
181 tracerec->specific.user.exec_us = RF_ETIMER_VAL_US(timer);
182 RF_ETIMER_START(tracerec->timer);
183 #endif
185 /* skip to dag which just finished */
186 dag_h = dagList->dags;
187 for (i = 0; i < dagList->numDagsDone; i++) {
188 dag_h = dag_h->next;
191 /* check to see if retry is required */
192 if (dag_h->status == rf_rollBackward) {
193 /* when a dag fails, mark desc status as bad and allow
194 * all other dags in the desc to execute to
195 * completion. then, free all dags and start over */
196 desc->status = 1; /* bad status */
197 #if 0
198 printf("raid%d: DAG failure: %c addr 0x%lx "
199 "(%ld) nblk 0x%x (%d) buf 0x%lx state %d\n",
200 desc->raidPtr->raidid, desc->type,
201 (long) desc->raidAddress,
202 (long) desc->raidAddress, (int) desc->numBlocks,
203 (int) desc->numBlocks,
204 (unsigned long) (desc->bufPtr), desc->state);
205 #endif
207 dagList->numDagsDone++;
208 rf_ContinueRaidAccess(desc);
212 rf_State_LastState(RF_RaidAccessDesc_t *desc)
214 void (*callbackFunc) (RF_CBParam_t) = desc->callbackFunc;
215 RF_CBParam_t callbackArg;
217 callbackArg.p = desc->callbackArg;
220 * If this is not an async request, wake up the caller
222 if (desc->async_flag == 0)
223 wakeup(desc->bp);
226 * That's all the IO for this one... unbusy the 'disk'.
229 rf_disk_unbusy(desc);
232 * Wakeup any requests waiting to go.
235 RF_LOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
236 ((RF_Raid_t *) desc->raidPtr)->openings++;
237 RF_UNLOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex);
239 wakeup(&(desc->raidPtr->iodone));
242 * The parity_map hook has to go here, because the iodone
243 * callback goes straight into the kintf layer.
245 if (desc->raidPtr->parity_map != NULL &&
246 desc->type == RF_IO_TYPE_WRITE)
247 rf_paritymap_end(desc->raidPtr->parity_map,
248 desc->raidAddress, desc->numBlocks);
250 /* printf("Calling biodone on 0x%x\n",desc->bp); */
251 biodone(desc->bp); /* access came through ioctl */
253 if (callbackFunc)
254 callbackFunc(callbackArg);
255 rf_FreeRaidAccDesc(desc);
257 return RF_FALSE;
261 rf_State_IncrAccessCount(RF_RaidAccessDesc_t *desc)
263 RF_Raid_t *raidPtr;
265 raidPtr = desc->raidPtr;
266 /* Bummer. We have to do this to be 100% safe w.r.t. the increment
267 * below */
268 RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
269 raidPtr->accs_in_flight++; /* used to detect quiescence */
270 RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
272 desc->state++;
273 return RF_FALSE;
277 rf_State_DecrAccessCount(RF_RaidAccessDesc_t *desc)
279 RF_Raid_t *raidPtr;
281 raidPtr = desc->raidPtr;
283 RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
284 raidPtr->accs_in_flight--;
285 if (raidPtr->accesses_suspended && raidPtr->accs_in_flight == 0) {
286 rf_SignalQuiescenceLock(raidPtr);
288 RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
290 desc->state++;
291 return RF_FALSE;
295 rf_State_Quiesce(RF_RaidAccessDesc_t *desc)
297 #if RF_ACC_TRACE > 0
298 RF_AccTraceEntry_t *tracerec = &desc->tracerec;
299 RF_Etimer_t timer;
300 #endif
301 RF_CallbackDesc_t *cb;
302 RF_Raid_t *raidPtr;
303 int suspended = RF_FALSE;
304 int need_cb, used_cb;
306 raidPtr = desc->raidPtr;
308 #if RF_ACC_TRACE > 0
309 RF_ETIMER_START(timer);
310 RF_ETIMER_START(desc->timer);
311 #endif
313 need_cb = 0;
314 used_cb = 0;
315 cb = NULL;
317 RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
318 /* Do an initial check to see if we might need a callback structure */
319 if (raidPtr->accesses_suspended) {
320 need_cb = 1;
322 RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
324 if (need_cb) {
325 /* create a callback if we might need it...
326 and we likely do. */
327 cb = rf_AllocCallbackDesc();
330 RF_LOCK_MUTEX(raidPtr->access_suspend_mutex);
331 if (raidPtr->accesses_suspended) {
332 cb->callbackFunc = (void (*) (RF_CBParam_t)) rf_ContinueRaidAccess;
333 cb->callbackArg.p = (void *) desc;
334 cb->next = raidPtr->quiesce_wait_list;
335 raidPtr->quiesce_wait_list = cb;
336 suspended = RF_TRUE;
337 used_cb = 1;
339 RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex);
341 if ((need_cb == 1) && (used_cb == 0)) {
342 rf_FreeCallbackDesc(cb);
345 #if RF_ACC_TRACE > 0
346 RF_ETIMER_STOP(timer);
347 RF_ETIMER_EVAL(timer);
348 tracerec->specific.user.suspend_ovhd_us += RF_ETIMER_VAL_US(timer);
349 #endif
351 #if RF_DEBUG_QUIESCE
352 if (suspended && rf_quiesceDebug)
353 printf("Stalling access due to quiescence lock\n");
354 #endif
355 desc->state++;
356 return suspended;
360 rf_State_Map(RF_RaidAccessDesc_t *desc)
362 RF_Raid_t *raidPtr = desc->raidPtr;
363 #if RF_ACC_TRACE > 0
364 RF_AccTraceEntry_t *tracerec = &desc->tracerec;
365 RF_Etimer_t timer;
367 RF_ETIMER_START(timer);
368 #endif
370 if (!(desc->asmap = rf_MapAccess(raidPtr, desc->raidAddress, desc->numBlocks,
371 desc->bufPtr, RF_DONT_REMAP)))
372 RF_PANIC();
374 #if RF_ACC_TRACE > 0
375 RF_ETIMER_STOP(timer);
376 RF_ETIMER_EVAL(timer);
377 tracerec->specific.user.map_us = RF_ETIMER_VAL_US(timer);
378 #endif
380 desc->state++;
381 return RF_FALSE;
385 rf_State_Lock(RF_RaidAccessDesc_t *desc)
387 #if RF_ACC_TRACE > 0
388 RF_AccTraceEntry_t *tracerec = &desc->tracerec;
389 RF_Etimer_t timer;
390 #endif
391 RF_Raid_t *raidPtr = desc->raidPtr;
392 RF_AccessStripeMapHeader_t *asmh = desc->asmap;
393 RF_AccessStripeMap_t *asm_p;
394 RF_StripeNum_t lastStripeID = -1;
395 int suspended = RF_FALSE;
397 #if RF_ACC_TRACE > 0
398 RF_ETIMER_START(timer);
399 #endif
401 /* acquire each lock that we don't already hold */
402 for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) {
403 RF_ASSERT(RF_IO_IS_R_OR_W(desc->type));
404 if (!rf_suppressLocksAndLargeWrites &&
405 asm_p->parityInfo &&
406 !(desc->flags & RF_DAG_SUPPRESS_LOCKS) &&
407 !(asm_p->flags & RF_ASM_FLAGS_LOCK_TRIED)) {
408 asm_p->flags |= RF_ASM_FLAGS_LOCK_TRIED;
409 /* locks must be acquired hierarchically */
410 RF_ASSERT(asm_p->stripeID > lastStripeID);
411 lastStripeID = asm_p->stripeID;
413 RF_INIT_LOCK_REQ_DESC(asm_p->lockReqDesc, desc->type,
414 (void (*) (struct buf *)) rf_ContinueRaidAccess, desc, asm_p,
415 raidPtr->Layout.dataSectorsPerStripe);
416 if (rf_AcquireStripeLock(raidPtr->lockTable, asm_p->stripeID,
417 &asm_p->lockReqDesc)) {
418 suspended = RF_TRUE;
419 break;
422 if (desc->type == RF_IO_TYPE_WRITE &&
423 raidPtr->status == rf_rs_reconstructing) {
424 if (!(asm_p->flags & RF_ASM_FLAGS_FORCE_TRIED)) {
425 int val;
427 asm_p->flags |= RF_ASM_FLAGS_FORCE_TRIED;
428 val = rf_ForceOrBlockRecon(raidPtr, asm_p,
429 (void (*) (RF_Raid_t *, void *)) rf_ContinueRaidAccess, desc);
430 if (val == 0) {
431 asm_p->flags |= RF_ASM_FLAGS_RECON_BLOCKED;
432 } else {
433 suspended = RF_TRUE;
434 break;
436 } else {
437 #if RF_DEBUG_PSS > 0
438 if (rf_pssDebug) {
439 printf("raid%d: skipping force/block because already done, psid %ld\n",
440 desc->raidPtr->raidid,
441 (long) asm_p->stripeID);
443 #endif
445 } else {
446 #if RF_DEBUG_PSS > 0
447 if (rf_pssDebug) {
448 printf("raid%d: skipping force/block because not write or not under recon, psid %ld\n",
449 desc->raidPtr->raidid,
450 (long) asm_p->stripeID);
452 #endif
455 #if RF_ACC_TRACE > 0
456 RF_ETIMER_STOP(timer);
457 RF_ETIMER_EVAL(timer);
458 tracerec->specific.user.lock_us += RF_ETIMER_VAL_US(timer);
459 #endif
460 if (suspended)
461 return (RF_TRUE);
463 desc->state++;
464 return (RF_FALSE);
467 * the following three states create, execute, and post-process dags
468 * the error recovery unit is a single dag.
469 * by default, SelectAlgorithm creates an array of dags, one per parity stripe
470 * in some tricky cases, multiple dags per stripe are created
471 * - dags within a parity stripe are executed sequentially (arbitrary order)
472 * - dags for distinct parity stripes are executed concurrently
474 * repeat until all dags complete successfully -or- dag selection fails
476 * while !done
477 * create dag(s) (SelectAlgorithm)
478 * if dag
479 * execute dag (DispatchDAG)
480 * if dag successful
481 * done (SUCCESS)
482 * else
483 * !done (RETRY - start over with new dags)
484 * else
485 * done (FAIL)
488 rf_State_CreateDAG(RF_RaidAccessDesc_t *desc)
490 #if RF_ACC_TRACE > 0
491 RF_AccTraceEntry_t *tracerec = &desc->tracerec;
492 RF_Etimer_t timer;
493 #endif
494 RF_DagHeader_t *dag_h;
495 RF_DagList_t *dagList;
496 struct buf *bp;
497 int i, selectStatus;
499 /* generate a dag for the access, and fire it off. When the dag
500 * completes, we'll get re-invoked in the next state. */
501 #if RF_ACC_TRACE > 0
502 RF_ETIMER_START(timer);
503 #endif
504 /* SelectAlgorithm returns one or more dags */
505 selectStatus = rf_SelectAlgorithm(desc, desc->flags | RF_DAG_SUPPRESS_LOCKS);
506 #if RF_DEBUG_VALIDATE_DAG
507 if (rf_printDAGsDebug) {
508 dagList = desc->dagList;
509 for (i = 0; i < desc->numStripes; i++) {
510 rf_PrintDAGList(dagList->dags);
511 dagList = dagList->next;
514 #endif /* RF_DEBUG_VALIDATE_DAG */
515 #if RF_ACC_TRACE > 0
516 RF_ETIMER_STOP(timer);
517 RF_ETIMER_EVAL(timer);
518 /* update time to create all dags */
519 tracerec->specific.user.dag_create_us = RF_ETIMER_VAL_US(timer);
520 #endif
522 desc->status = 0; /* good status */
524 if (selectStatus || (desc->numRetries > RF_RETRY_THRESHOLD)) {
525 /* failed to create a dag */
526 /* this happens when there are too many faults or incomplete
527 * dag libraries */
528 if (selectStatus) {
529 printf("raid%d: failed to create a dag. "
530 "Too many component failures.\n",
531 desc->raidPtr->raidid);
532 } else {
533 printf("raid%d: IO failed after %d retries.\n",
534 desc->raidPtr->raidid, RF_RETRY_THRESHOLD);
537 desc->status = 1; /* bad status */
538 /* skip straight to rf_State_Cleanup() */
539 desc->state = rf_CleanupState;
540 bp = (struct buf *)desc->bp;
541 bp->b_error = EIO;
542 bp->b_resid = bp->b_bcount;
543 } else {
544 /* bind dags to desc */
545 dagList = desc->dagList;
546 for (i = 0; i < desc->numStripes; i++) {
547 dag_h = dagList->dags;
548 while (dag_h) {
549 dag_h->bp = (struct buf *) desc->bp;
550 #if RF_ACC_TRACE > 0
551 dag_h->tracerec = tracerec;
552 #endif
553 dag_h = dag_h->next;
555 dagList = dagList->next;
557 desc->flags |= RF_DAG_DISPATCH_RETURNED;
558 desc->state++; /* next state should be rf_State_ExecuteDAG */
560 return RF_FALSE;
565 /* the access has an list of dagLists, one dagList per parity stripe.
566 * fire the first dag in each parity stripe (dagList).
567 * dags within a stripe (dagList) must be executed sequentially
568 * - this preserves atomic parity update
569 * dags for independents parity groups (stripes) are fired concurrently */
572 rf_State_ExecuteDAG(RF_RaidAccessDesc_t *desc)
574 int i;
575 RF_DagHeader_t *dag_h;
576 RF_DagList_t *dagList;
578 /* next state is always rf_State_ProcessDAG important to do
579 * this before firing the first dag (it may finish before we
580 * leave this routine) */
581 desc->state++;
583 /* sweep dag array, a stripe at a time, firing the first dag
584 * in each stripe */
585 dagList = desc->dagList;
586 for (i = 0; i < desc->numStripes; i++) {
587 RF_ASSERT(dagList->numDags > 0);
588 RF_ASSERT(dagList->numDagsDone == 0);
589 RF_ASSERT(dagList->numDagsFired == 0);
590 #if RF_ACC_TRACE > 0
591 RF_ETIMER_START(dagList->tracerec.timer);
592 #endif
593 /* fire first dag in this stripe */
594 dag_h = dagList->dags;
595 RF_ASSERT(dag_h);
596 dagList->numDagsFired++;
597 rf_DispatchDAG(dag_h, (void (*) (void *)) rf_ContinueDagAccess, dagList);
598 dagList = dagList->next;
601 /* the DAG will always call the callback, even if there was no
602 * blocking, so we are always suspended in this state */
603 return RF_TRUE;
608 /* rf_State_ProcessDAG is entered when a dag completes.
609 * first, check to all dags in the access have completed
610 * if not, fire as many dags as possible */
613 rf_State_ProcessDAG(RF_RaidAccessDesc_t *desc)
615 RF_AccessStripeMapHeader_t *asmh = desc->asmap;
616 RF_Raid_t *raidPtr = desc->raidPtr;
617 RF_DagHeader_t *dag_h;
618 int i, j, done = RF_TRUE;
619 RF_DagList_t *dagList, *temp;
621 /* check to see if this is the last dag */
622 dagList = desc->dagList;
623 for (i = 0; i < desc->numStripes; i++) {
624 if (dagList->numDags != dagList->numDagsDone)
625 done = RF_FALSE;
626 dagList = dagList->next;
629 if (done) {
630 if (desc->status) {
631 /* a dag failed, retry */
632 /* free all dags */
633 dagList = desc->dagList;
634 for (i = 0; i < desc->numStripes; i++) {
635 rf_FreeDAG(dagList->dags);
636 temp = dagList;
637 dagList = dagList->next;
638 rf_FreeDAGList(temp);
640 desc->dagList = NULL;
642 rf_MarkFailuresInASMList(raidPtr, asmh);
644 /* note the retry so that we'll bail in
645 rf_State_CreateDAG() once we've retired
646 the IO RF_RETRY_THRESHOLD times */
648 desc->numRetries++;
650 /* back up to rf_State_CreateDAG */
651 desc->state = desc->state - 2;
652 return RF_FALSE;
653 } else {
654 /* move on to rf_State_Cleanup */
655 desc->state++;
657 return RF_FALSE;
658 } else {
659 /* more dags to execute */
660 /* see if any are ready to be fired. if so, fire them */
661 /* don't fire the initial dag in a list, it's fired in
662 * rf_State_ExecuteDAG */
663 dagList = desc->dagList;
664 for (i = 0; i < desc->numStripes; i++) {
665 if ((dagList->numDagsDone < dagList->numDags)
666 && (dagList->numDagsDone == dagList->numDagsFired)
667 && (dagList->numDagsFired > 0)) {
668 #if RF_ACC_TRACE > 0
669 RF_ETIMER_START(dagList->tracerec.timer);
670 #endif
671 /* fire next dag in this stripe */
672 /* first, skip to next dag awaiting execution */
673 dag_h = dagList->dags;
674 for (j = 0; j < dagList->numDagsDone; j++)
675 dag_h = dag_h->next;
676 dagList->numDagsFired++;
677 rf_DispatchDAG(dag_h, (void (*) (void *)) rf_ContinueDagAccess,
678 dagList);
680 dagList = dagList->next;
682 return RF_TRUE;
685 /* only make it this far if all dags complete successfully */
687 rf_State_Cleanup(RF_RaidAccessDesc_t *desc)
689 #if RF_ACC_TRACE > 0
690 RF_AccTraceEntry_t *tracerec = &desc->tracerec;
691 RF_Etimer_t timer;
692 #endif
693 RF_AccessStripeMapHeader_t *asmh = desc->asmap;
694 RF_Raid_t *raidPtr = desc->raidPtr;
695 RF_AccessStripeMap_t *asm_p;
696 RF_DagList_t *dagList;
697 int i;
699 desc->state++;
701 #if RF_ACC_TRACE > 0
702 timer = tracerec->timer;
703 RF_ETIMER_STOP(timer);
704 RF_ETIMER_EVAL(timer);
705 tracerec->specific.user.dag_retry_us = RF_ETIMER_VAL_US(timer);
707 /* the RAID I/O is complete. Clean up. */
708 tracerec->specific.user.dag_retry_us = 0;
710 RF_ETIMER_START(timer);
711 #endif
712 /* free all dags */
713 dagList = desc->dagList;
714 for (i = 0; i < desc->numStripes; i++) {
715 rf_FreeDAG(dagList->dags);
716 dagList = dagList->next;
718 #if RF_ACC_TRACE > 0
719 RF_ETIMER_STOP(timer);
720 RF_ETIMER_EVAL(timer);
721 tracerec->specific.user.cleanup_us = RF_ETIMER_VAL_US(timer);
723 RF_ETIMER_START(timer);
724 #endif
725 for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) {
726 if (!rf_suppressLocksAndLargeWrites &&
727 asm_p->parityInfo &&
728 !(desc->flags & RF_DAG_SUPPRESS_LOCKS)) {
729 RF_ASSERT_VALID_LOCKREQ(&asm_p->lockReqDesc);
730 rf_ReleaseStripeLock(raidPtr->lockTable,
731 asm_p->stripeID,
732 &asm_p->lockReqDesc);
734 if (asm_p->flags & RF_ASM_FLAGS_RECON_BLOCKED) {
735 rf_UnblockRecon(raidPtr, asm_p);
738 #if RF_ACC_TRACE > 0
739 RF_ETIMER_STOP(timer);
740 RF_ETIMER_EVAL(timer);
741 tracerec->specific.user.lock_us += RF_ETIMER_VAL_US(timer);
743 RF_ETIMER_START(timer);
744 #endif
745 rf_FreeAccessStripeMap(asmh);
746 #if RF_ACC_TRACE > 0
747 RF_ETIMER_STOP(timer);
748 RF_ETIMER_EVAL(timer);
749 tracerec->specific.user.cleanup_us += RF_ETIMER_VAL_US(timer);
751 RF_ETIMER_STOP(desc->timer);
752 RF_ETIMER_EVAL(desc->timer);
754 timer = desc->tracerec.tot_timer;
755 RF_ETIMER_STOP(timer);
756 RF_ETIMER_EVAL(timer);
757 desc->tracerec.total_us = RF_ETIMER_VAL_US(timer);
759 rf_LogTraceRec(raidPtr, tracerec);
760 #endif
761 desc->flags |= RF_DAG_ACCESS_COMPLETE;
763 return RF_FALSE;