aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/raid
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2007-07-09 14:56:43 -0400
committerDan Williams <dan.j.williams@intel.com>2007-07-13 11:06:15 -0400
commita445685647e825c713175d180ffc8dd54d90589b (patch)
treed2db5674e51d33162e1e5993b6e6680ec534e2df /include/linux/raid
parent9bc89cd82d6f88fb0ca39b30445c329a430fd66b (diff)
raid5: refactor handle_stripe5 and handle_stripe6 (v3)
handle_stripe5 and handle_stripe6 have very deep logic paths handling the various states of a stripe_head. By introducing the 'stripe_head_state' and 'r6_state' objects, large portions of the logic can be moved to sub-routines. 'struct stripe_head_state' consumes all of the automatic variables that previously stood alone in handle_stripe5,6. 'struct r6_state' contains the handle_stripe6 specific variables like p_failed and q_failed. One of the nice side effects of the 'stripe_head_state' change is that it allows for further reductions in code duplication between raid5 and raid6. The following new routines are shared between raid5 and raid6: handle_completed_write_requests handle_requests_to_failed_array handle_stripe_expansion Changes: * v2: fixed 'conf->raid_disk-1' for the raid6 'handle_stripe_expansion' path * v3: removed the unused 'dirty' field from struct stripe_head_state * v3: coalesced open coded bi_end_io routines into return_io() Signed-off-by: Dan Williams <dan.j.williams@intel.com> Acked-By: NeilBrown <neilb@suse.de>
Diffstat (limited to 'include/linux/raid')
-rw-r--r--include/linux/raid/raid5.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index d8286db60b96..b99d354f6128 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -145,6 +145,22 @@ struct stripe_head {
145 unsigned long flags; 145 unsigned long flags;
146 } dev[1]; /* allocated with extra space depending of RAID geometry */ 146 } dev[1]; /* allocated with extra space depending of RAID geometry */
147}; 147};
148
149/* stripe_head_state - collects and tracks the dynamic state of a stripe_head
150 * for handle_stripe. It is only valid under spin_lock(sh->lock);
151 */
152struct stripe_head_state {
153 int syncing, expanding, expanded;
154 int locked, uptodate, to_read, to_write, failed, written;
155 int non_overwrite;
156 int failed_num;
157};
158
159/* r6_state - extra state data only relevant to r6 */
160struct r6_state {
161 int p_failed, q_failed, qd_idx, failed_num[2];
162};
163
148/* Flags */ 164/* Flags */
149#define R5_UPTODATE 0 /* page contains current data */ 165#define R5_UPTODATE 0 /* page contains current data */
150#define R5_LOCKED 1 /* IO has been submitted on "req" */ 166#define R5_LOCKED 1 /* IO has been submitted on "req" */