aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-12-22 18:17:53 -0500
committerNeilBrown <neilb@suse.de>2011-12-22 18:17:53 -0500
commit9a3e1101b827a59ac9036a672f5fa8d5279d0fe2 (patch)
tree9e629fbc1bab31b588c475181246bbe30778f67a /drivers/md/raid5.h
parent977df36255ab0ea78b048cbc9055300c586dcc91 (diff)
md/raid5: detect and handle replacements during recovery.
During recovery we want to write to the replacement but not the original. So we have two new flags - R5_NeedReplace if this stripe has a replacement that needs to be written at some stage - R5_WantReplace if NeedReplace, and the data is available, and a 'sync' has been requested on this stripe. We also distinguish between 'sync and replace' which need to read all other devices, and 'replace' which only needs to read the devices being replaced. Note that during resync we always write to any replacement device. It might not need to be written to, but as we don't read to compare, we have to write to be sure. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.h')
-rw-r--r--drivers/md/raid5.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index f6faaa16a565..8d8e13934a48 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -242,7 +242,13 @@ struct stripe_head {
242 * for handle_stripe. 242 * for handle_stripe.
243 */ 243 */
244struct stripe_head_state { 244struct stripe_head_state {
245 int syncing, expanding, expanded; 245 /* 'syncing' means that we need to read all devices, either
246 * to check/correct parity, or to reconstruct a missing device.
247 * 'replacing' means we are replacing one or more drives and
248 * the source is valid at this point so we don't need to
249 * read all devices, just the replacement targets.
250 */
251 int syncing, expanding, expanded, replacing;
246 int locked, uptodate, to_read, to_write, failed, written; 252 int locked, uptodate, to_read, to_write, failed, written;
247 int to_fill, compute, req_compute, non_overwrite; 253 int to_fill, compute, req_compute, non_overwrite;
248 int failed_num[2]; 254 int failed_num[2];
@@ -284,6 +290,11 @@ enum r5dev_flags {
284 R5_ReadRepl, /* Will/did read from replacement rather than orig */ 290 R5_ReadRepl, /* Will/did read from replacement rather than orig */
285 R5_MadeGoodRepl,/* A bad block on the replacement device has been 291 R5_MadeGoodRepl,/* A bad block on the replacement device has been
286 * fixed by writing to it */ 292 * fixed by writing to it */
293 R5_NeedReplace, /* This device has a replacement which is not
294 * up-to-date at this stripe. */
295 R5_WantReplace, /* We need to update the replacement, we have read
296 * data in, and now is a good time to write it out.
297 */
287}; 298};
288 299
289/* 300/*