diff options
author | majianpeng <majianpeng@gmail.com> | 2012-11-19 06:57:34 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-12-13 03:52:11 -0500 |
commit | 0a19caabf01ac138bf3668786939e50ea4d9c8ac (patch) | |
tree | dc672faa83d44dbbb8097b367a35ce1cfba9c90f /drivers/md/md.c | |
parent | 4f8c55c5ad491dbc7b52ce08bb702ca39ce944cf (diff) |
md: Use ->curr_resync as last completed request when cleanly aborting resync.
If a resync is aborted cleanly, ->curr_resync is a reliable
record of where we got up to.
If there was an error it is less reliable but we always know that
->curr_resync_completed is safe.
So add a flag MD_RECOVERY_ERROR to differentiate between these cases
and set recovery_cp accordingly.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 6aefa4434819..30ba223e5ed0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7180,6 +7180,7 @@ void md_done_sync(struct mddev *mddev, int blocks, int ok) | |||
7180 | wake_up(&mddev->recovery_wait); | 7180 | wake_up(&mddev->recovery_wait); |
7181 | if (!ok) { | 7181 | if (!ok) { |
7182 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 7182 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
7183 | set_bit(MD_RECOVERY_ERROR, &mddev->recovery); | ||
7183 | md_wakeup_thread(mddev->thread); | 7184 | md_wakeup_thread(mddev->thread); |
7184 | // stop recovery, signal do_sync .... | 7185 | // stop recovery, signal do_sync .... |
7185 | } | 7186 | } |
@@ -7574,8 +7575,13 @@ void md_do_sync(struct md_thread *thread) | |||
7574 | printk(KERN_INFO | 7575 | printk(KERN_INFO |
7575 | "md: checkpointing %s of %s.\n", | 7576 | "md: checkpointing %s of %s.\n", |
7576 | desc, mdname(mddev)); | 7577 | desc, mdname(mddev)); |
7577 | mddev->recovery_cp = | 7578 | if (test_bit(MD_RECOVERY_ERROR, |
7578 | mddev->curr_resync_completed; | 7579 | &mddev->recovery)) |
7580 | mddev->recovery_cp = | ||
7581 | mddev->curr_resync_completed; | ||
7582 | else | ||
7583 | mddev->recovery_cp = | ||
7584 | mddev->curr_resync; | ||
7579 | } | 7585 | } |
7580 | } else | 7586 | } else |
7581 | mddev->recovery_cp = MaxSector; | 7587 | mddev->recovery_cp = MaxSector; |