NetBSD/sys/dev/raidframe
oster 87e6ffb752 As noted by Thierry Deval in a posting to misc/at/openbsd.org,
rf_DecrAccessesCountState wasn't in the correct spot in
RF_AccessState_e.  Following up on that has resulted in one other
correction.  Changing orderings of these states is tricky, and
shouldn't be attempted without some thorough analysis.  For the
changes committed, the following analysis is offerred:

1) RAIDframe uses a little state machine to take care of building,
executing, and processing the DAGs used to direct IO.

2) The rf_DecrAccessesCountState state is handled by the function
rf_State_DecrAccessCount().  The purpose of this state is to
decrement the number of "accesses-in-flight".

3) rf_Cleanup_State is handled by rf_State_Cleanup().  Its job is to
do general cleanup of DAG arrays and any stripe locks.

4) DefaultStates[] in rf_layout.c indicates that the right spot
for rf_DecrAccessesCountState is just before rf_Cleanup_State.
Analysis of code for both states indicates that the order doesn't
matter too much, although rf_State_DecrAccessCount() should probably
take place *after* rf_State_Cleanup() to be more correct.

5) Comments in rf_State_ProcessDAG() indicates that the next state
should be rf_Cleanup_State.  However: it attempts to get there by using

 desc->state++;

which actually takes it to just rf_DecrAccessesCountState! This turned
out to be OK before, since rf_Cleanup_State would follow right after,
and all would be taken careof (albeit in arguably the "less correct"
order).

6) With the current ordering, if we head directly to rf_Cleanup_State
(as we do, for example, if multiple components fail in a RAID 5 set),
then we'll actually miss going trough rf_DecrAccessesCountState), and
could end up never being able to reach quiescence!  Perhaps not too
big of a deal, given that the RAID set is pretty much toast by that
point at which such a drastic state change happens, but might as well
have this correct.

The changes made are:
1) Since having rf_State_DecrAccessCount() come after
rf_State_Cleanup() is just fine, change rf_layout.c to reflect that
rf_DecrAccessesCountState comes after rf_Cleanup_State (i.e. they swap
positions in the state list).  This means that going to
rf_Cleanup_State after bailing on a failed DAG access will do all the
right things -- the state will get cleaned up, and then the access
counts will get decremented properly.  The comment in
rf_State_ProcessDAG() is now actually correct -- the next state *will*
be rf_Cleanup_State.

2) Move rf_DecrAccessesCountState in RF_AccessState_e to just after
rf_CleanupState.  This puts RF_AccessState_e in sync with
DefaultStates[].  Fortunately, these states are rarely referred to by
name, and so this change ends up being mostly cosmetic -- it really
only fixes cleanup behaviour for the recent "Failed to create a DAG"
changes.
2004-01-04 06:37:16 +00:00
..
files.raidframe The ugly wonderment of appropriately placed ASCII characters 2003-12-29 06:37:47 +00:00
Makefile
raidframeio.h
raidframevar.h As noted by Thierry Deval in a posting to misc/at/openbsd.org, 2004-01-04 06:37:16 +00:00
rf_acctrace.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_acctrace.h
rf_alloclist.c Replace the DO_FREE() macro with just RF_Free(). No functional changes, 2003-12-31 16:32:50 +00:00
rf_alloclist.h
rf_archs.h
rf_aselect.c Fix the "We panic if we can't create a DAG" problem that's existed 2004-01-02 21:41:08 +00:00
rf_aselect.h
rf_callback.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_callback.h
rf_chaindecluster.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_chaindecluster.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_copyback.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_copyback.h Nuke a few more 'row'-related bits that were missed in the row-removal. 2004-01-01 19:32:55 +00:00
rf_cvscan.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_cvscan.h
rf_dag.h
rf_dagdegrd.c Finally cleanup RF_BZERO. Turns out that 'bp' was only used to obtain 2004-01-01 20:39:58 +00:00
rf_dagdegrd.h constify some 2003-02-09 10:04:32 +00:00
rf_dagdegwr.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_dagdegwr.h
rf_dagffrd.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_dagffrd.h
rf_dagffwr.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_dagffwr.h constify some 2003-02-09 10:04:32 +00:00
rf_dagflags.h Cleanup some unused desc->flags: 2004-01-01 23:35:08 +00:00
rf_dagfuncs.c nuke the 'bp' argument to rf_bxor and friends since it is no longer used. 2003-12-31 00:00:06 +00:00
rf_dagfuncs.h nuke the 'bp' argument to rf_bxor and friends since it is no longer used. 2003-12-31 00:00:06 +00:00
rf_dagutils.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_dagutils.h constify some 2003-02-09 10:04:32 +00:00
rf_debugMem.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_debugMem.h - first kick at a major reworking of RAIDframe's memory allocation code: 2003-12-29 03:33:47 +00:00
rf_debugprint.c Tidy up the #includes a bit. 2004-01-01 19:37:17 +00:00
rf_debugprint.h
rf_decluster.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_decluster.h
rf_declusterPQ.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_declusterPQ.h
rf_desc.h Nuke a bunch of unused variables: 2004-01-01 19:27:35 +00:00
rf_diskqueue.c Nuke a bunch of unused variables: 2004-01-01 19:27:35 +00:00
rf_diskqueue.h Nuke a bunch of unused variables: 2004-01-01 19:27:35 +00:00
rf_disks.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_disks.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_driver.c Nuke a bunch of unused variables: 2004-01-01 19:27:35 +00:00
rf_driver.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_engine.c Fix the "We panic if we can't create a DAG" problem that's existed 2004-01-02 21:41:08 +00:00
rf_engine.h
rf_etimer.h
rf_evenodd_dagfuncs.c [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_evenodd_dagfuncs.h
rf_evenodd_dags.c
rf_evenodd_dags.h
rf_evenodd.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_evenodd.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_fifo.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_fifo.h
rf_general.h Finally cleanup RF_BZERO. Turns out that 'bp' was only used to obtain 2004-01-01 20:39:58 +00:00
rf_geniq.c
rf_hist.h
rf_interdecluster.c
rf_interdecluster.h
rf_invertq.c
rf_invertq.h
rf_kintf.h Back out the lwp/ktrace changes. They contained a lot of colateral damage, 2003-06-29 22:28:00 +00:00
rf_layout.c As noted by Thierry Deval in a posting to misc/at/openbsd.org, 2004-01-04 06:37:16 +00:00
rf_layout.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_map.c No point keeping 'pt' around. It's only ever assigned to. 2003-12-30 22:12:10 +00:00
rf_map.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_mcpair.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_mcpair.h
rf_netbsd.h
rf_netbsdkintf.c Remove a couple of incorrect comments. (rf_recon_req needs to be 2003-12-31 03:02:57 +00:00
rf_nwayxor.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_nwayxor.h
rf_options.c
rf_options.h
rf_optnames.h Remove 3 unused debugging options: 2003-12-31 22:25:38 +00:00
rf_paritylog.c
rf_paritylog.h
rf_paritylogDiskMgr.c [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_paritylogDiskMgr.h
rf_paritylogging.c _rf_create_managed_cond() is now left doing nothing. Convert callers. 2003-12-29 05:48:13 +00:00
rf_paritylogging.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_parityloggingdags.c - first kick at a major reworking of RAIDframe's memory allocation code: 2003-12-29 03:33:47 +00:00
rf_parityloggingdags.h
rf_parityscan.c Fix comments and make function declarations conform. 2003-12-31 16:23:50 +00:00
rf_parityscan.h
rf_pq.c infoFunc doesn't exist any more. Nuke commented out bits refering 2003-11-16 20:32:05 +00:00
rf_pq.h
rf_pqdeg.c
rf_pqdeg.h
rf_pqdegdags.c
rf_pqdegdags.h
rf_psstatus.c Increase the scope of RF_DEBUG_PSS to cover a bit more stuff. 2003-12-31 00:42:46 +00:00
rf_psstatus.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid0.c Fix the "We panic if we can't create a DAG" problem that's existed 2004-01-02 21:41:08 +00:00
rf_raid0.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid1.c Fix the "We panic if we can't create a DAG" problem that's existed 2004-01-02 21:41:08 +00:00
rf_raid1.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid4.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_raid4.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid5_rotatedspare.c [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid5_rotatedspare.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid5.c Fix the "We panic if we can't create a DAG" problem that's existed 2004-01-02 21:41:08 +00:00
rf_raid5.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_raid.h Nuke a bunch of unused variables: 2004-01-01 19:27:35 +00:00
rf_reconbuffer.c Remove "row" from DEBUG statements. 2004-01-02 11:52:15 +00:00
rf_reconbuffer.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_reconmap.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_reconmap.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_reconstruct.c Add in a bunch of RF_SIGNAL_COND()'s that were missing. Tidy up 2003-12-31 04:13:52 +00:00
rf_reconstruct.h Nuke a few more 'row'-related bits that were missed in the row-removal. 2004-01-01 19:32:55 +00:00
rf_reconutil.c Nuke a bunch of unused variables: 2004-01-01 19:27:35 +00:00
rf_reconutil.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_revent.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_revent.h [Having received a definite lack of strenuous objection, a small amount 2003-12-29 02:38:17 +00:00
rf_shutdown.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_shutdown.h
rf_sstf.c - first kick at a major reworking of RAIDframe's memory allocation code: 2003-12-29 03:33:47 +00:00
rf_sstf.h
rf_states.c Fix the "We panic if we can't create a DAG" problem that's existed 2004-01-02 21:41:08 +00:00
rf_states.h
rf_stripelocks.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_stripelocks.h rf_MakeLockTable() and rf_ShutdownStripeLocks() are used only in 2003-04-10 04:10:17 +00:00
rf_strutils.c
rf_threadstuff.h rf_lkmgr_mutex_init() is only called from one spot, and it really 2003-12-29 06:30:42 +00:00
rf_utils.c Some days you wonder if some of the function declaration consistency 2003-12-30 21:59:03 +00:00
rf_utils.h