Skip to contentSkip to conversation

md:Add place to update ->recovery_cp.

PATCH In review kernelmail 3 participants 3 messages Oct 27, 2012 – Oct 29, 2012 MD RAID

lore
Share & tools
lore

kernelmail

author
#0 lore raw

PATCH 2/5 md:Add place to update ->recovery_cp.

In resyncing, recovery_cp only updated when resync aborted or completed. But in md drives,many place used it to judge.So add a place to update.

---
 drivers/md/md.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/md/md.c +2 -0
index 1d9940d..01e25bd 100644
@@ -7454,6 +7454,8 @@ void md_do_sync(struct md_thread *thread)
 			wait_event(mddev->recovery_wait,
 				   atomic_read(&mddev->recovery_active) == 0);
 			mddev->curr_resync_completed = j;
+			if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
+				mddev->recovery_cp = j;
 			set_bit(MD_CHANGE_CLEAN, &mddev->flags);
 			sysfs_notify(&mddev->kobj, NULL, "sync_completed");
 		}
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 13 lines · On Sat, 27 Oct 2012 10:28:18 +0800 kernelmail <[email protected]> wrote:

In resyncing, recovery_cp only updated when resync aborted or completed. But in md drives,many place used it to judge.So add a place to update.

---
 drivers/md/md.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/md/md.c +0 -0
index 1d9940d..01e25bd 100644

drivers/md/md.c void md_do_sync(struct md_thread *thread) · line 7461

Quoted 8 lines
drivers/md/md.c +2 -0
@@ -7454,6 +7454,8 @@ void md_do_sync(struct md_thread *thread)
 			wait_event(mddev->recovery_wait,
 				   atomic_read(&mddev->recovery_active) == 0);
 			mddev->curr_resync_completed = j;
+			if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
+				mddev->recovery_cp = j;
 			set_bit(MD_CHANGE_CLEAN, &mddev->flags);
 			sysfs_notify(&mddev->kobj, NULL, "sync_completed");
 		}

This isn't correct. If MD_RECOVERY_REQUESTED, then j might be less than recovery_cp and we don't want to reduce recovery_cp.

If you would like to fix that (i.e. only set recovery_cp if it is less than 'j'), then I'll apply the patch.

NeilBrown

#2 lore raw
Quoted 27 lines · On Sat, 27 Oct 2012 10:28:18 +0800 kernelmail <[email protected]> wrote:
Quoted 14 lines

In resyncing, recovery_cp only updated when resync aborted or completed. But in md drives,many place used it to judge.So add a place to update.

---
 drivers/md/md.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/md/md.c +0 -0
index 1d9940d..01e25bd 100644

drivers/md/md.c void md_do_sync(struct md_thread *thread) · line 7461

Quoted 8 lines
drivers/md/md.c +2 -0
@@ -7454,6 +7454,8 @@ void md_do_sync(struct md_thread *thread)
 			wait_event(mddev->recovery_wait,
 				   atomic_read(&mddev->recovery_active) == 0);
 			mddev->curr_resync_completed = j;
+			if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
+				mddev->recovery_cp = j;
 			set_bit(MD_CHANGE_CLEAN, &mddev->flags);
 			sysfs_notify(&mddev->kobj, NULL, "sync_completed");
 		}

This isn't correct. If MD_RECOVERY_REQUESTED, then j might be less than recovery_cp and we don't want to reduce recovery_cp.

Quoted 5 lines

If you would like to fix that (i.e. only set recovery_cp if it is less than 'j'), then I'll apply the patch.

NeilBrown

Ok, i'll modify and resend to you.
Thanks!
Jianpeng