aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-06-27 18:31:57 -0400
committerNeil Brown <neilb@notabene.brown>2008-06-27 18:31:57 -0400
commitecc65c9b3f9b9d740a5deade3d85b39be56401b6 (patch)
treee6b4e827befc6849716689f573c89aa0a41e5d26 /include
parentf0e43bcdebf709d747a3effb210aff1941e819ab (diff)
md: replace STRIPE_OP_CHECK with 'check_states'
From: Dan Williams <dan.j.williams@intel.com> The STRIPE_OP_* flags record the state of stripe operations which are performed outside the stripe lock. Their use in indicating which operations need to be run is straightforward; however, interpolating what the next state of the stripe should be based on a given combination of these flags is not straightforward, and has led to bugs. An easier to read implementation with minimal degrees of freedom is needed. Towards this goal, this patch introduces explicit states to replace what was previously interpolated from the STRIPE_OP_* flags. For now this only converts the handle_parity_checks5 path, removing a user of the ops.{pending,ack,complete,count} fields of struct stripe_operations. This conversion also found a remaining issue with the current code. There is a small window for a drive to fail between when we schedule a repair and when the parity calculation for that repair completes. When this happens we will writeback to 'failed_num' when we really want to write back to 'pd_idx'. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/raid/raid5.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 1301195abf4b..2c96d5fd54bf 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -158,6 +158,41 @@
158 * the compute block completes. 158 * the compute block completes.
159 */ 159 */
160 160
161/*
162 * Operations state - intermediate states that are visible outside of sh->lock
163 * In general _idle indicates nothing is running, _run indicates a data
164 * processing operation is active, and _result means the data processing result
165 * is stable and can be acted upon. For simple operations like biofill and
166 * compute that only have an _idle and _run state they are indicated with
167 * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN)
168 */
169/**
170 * enum check_states - handles syncing / repairing a stripe
171 * @check_state_idle - check operations are quiesced
172 * @check_state_run - check operation is running
173 * @check_state_result - set outside lock when check result is valid
174 * @check_state_compute_run - check failed and we are repairing
175 * @check_state_compute_result - set outside lock when compute result is valid
176 */
177enum check_states {
178 check_state_idle = 0,
179 check_state_run, /* parity check */
180 check_state_check_result,
181 check_state_compute_run, /* parity repair */
182 check_state_compute_result,
183};
184
185/**
186 * enum reconstruct_states - handles writing or expanding a stripe
187 */
188enum reconstruct_states {
189 reconstruct_state_idle = 0,
190 reconstruct_state_drain_run, /* write */
191 reconstruct_state_run, /* expand */
192 reconstruct_state_drain_result,
193 reconstruct_state_result,
194};
195
161struct stripe_head { 196struct stripe_head {
162 struct hlist_node hash; 197 struct hlist_node hash;
163 struct list_head lru; /* inactive_list or handle_list */ 198 struct list_head lru; /* inactive_list or handle_list */
@@ -169,6 +204,7 @@ struct stripe_head {
169 spinlock_t lock; 204 spinlock_t lock;
170 int bm_seq; /* sequence number for bitmap flushes */ 205 int bm_seq; /* sequence number for bitmap flushes */
171 int disks; /* disks in stripe */ 206 int disks; /* disks in stripe */
207 enum check_states check_state;
172 /* stripe_operations 208 /* stripe_operations
173 * @pending - pending ops flags (set for request->issue->complete) 209 * @pending - pending ops flags (set for request->issue->complete)
174 * @ack - submitted ops flags (set for issue->complete) 210 * @ack - submitted ops flags (set for issue->complete)
@@ -202,6 +238,7 @@ struct stripe_head_state {
202 int locked, uptodate, to_read, to_write, failed, written; 238 int locked, uptodate, to_read, to_write, failed, written;
203 int to_fill, compute, req_compute, non_overwrite; 239 int to_fill, compute, req_compute, non_overwrite;
204 int failed_num; 240 int failed_num;
241 unsigned long ops_request;
205}; 242};
206 243
207/* r6_state - extra state data only relevant to r6 */ 244/* r6_state - extra state data only relevant to r6 */
@@ -254,8 +291,10 @@ struct r6_state {
254#define STRIPE_EXPAND_READY 11 291#define STRIPE_EXPAND_READY 11
255#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */ 292#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
256#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ 293#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
294#define STRIPE_BIOFILL_RUN 14
295#define STRIPE_COMPUTE_RUN 15
257/* 296/*
258 * Operations flags (in issue order) 297 * Operation request flags
259 */ 298 */
260#define STRIPE_OP_BIOFILL 0 299#define STRIPE_OP_BIOFILL 0
261#define STRIPE_OP_COMPUTE_BLK 1 300#define STRIPE_OP_COMPUTE_BLK 1
@@ -264,11 +303,6 @@ struct r6_state {
264#define STRIPE_OP_POSTXOR 4 303#define STRIPE_OP_POSTXOR 4
265#define STRIPE_OP_CHECK 5 304#define STRIPE_OP_CHECK 5
266 305
267/* modifiers to the base operations
268 * STRIPE_OP_MOD_REPAIR_PD - compute the parity block and write it back
269 */
270#define STRIPE_OP_MOD_REPAIR_PD 7
271
272/* 306/*
273 * Plugging: 307 * Plugging:
274 * 308 *