aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-11-11 20:08:04 -0500
committerNeilBrown <neilb@suse.de>2009-11-11 20:08:04 -0500
commit5e8651060cea6b44844521ddcac665e2c021f5d8 (patch)
tree56a2a3de85fae3f7e210c54a9cda305b0341c334 /drivers/md/md.c
parent8dee7211467a56b7eb4e4359efb0aa4a72e1b6f3 (diff)
md: factor out updating of 'recovery_offset'.
Each device has its own 'recovery_offset' showing how far recovery has progressed on the device. As the only real significance of this is that fact that it can be stored in the metadata and recovered at restart, and as only 1.x metadata can do this, we were only updating 'recovery_offset' to 'curr_resync_completed' when updating v1.x metadata. But this is wrong, and we will shortly make limited use of this field in v0.90 metadata. So move the update into common code. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index e64c971038d1..01b9a0fd16e0 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1382,8 +1382,6 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1382 1382
1383 if (rdev->raid_disk >= 0 && 1383 if (rdev->raid_disk >= 0 &&
1384 !test_bit(In_sync, &rdev->flags)) { 1384 !test_bit(In_sync, &rdev->flags)) {
1385 if (mddev->curr_resync_completed > rdev->recovery_offset)
1386 rdev->recovery_offset = mddev->curr_resync_completed;
1387 if (rdev->recovery_offset > 0) { 1385 if (rdev->recovery_offset > 0) {
1388 sb->feature_map |= 1386 sb->feature_map |=
1389 cpu_to_le32(MD_FEATURE_RECOVERY_OFFSET); 1387 cpu_to_le32(MD_FEATURE_RECOVERY_OFFSET);
@@ -1917,6 +1915,14 @@ static void sync_sbs(mddev_t * mddev, int nospares)
1917 */ 1915 */
1918 mdk_rdev_t *rdev; 1916 mdk_rdev_t *rdev;
1919 1917
1918 /* First make sure individual recovery_offsets are correct */
1919 list_for_each_entry(rdev, &mddev->disks, same_set) {
1920 if (rdev->raid_disk >= 0 &&
1921 !test_bit(In_sync, &rdev->flags) &&
1922 mddev->curr_resync_completed > rdev->recovery_offset)
1923 rdev->recovery_offset = mddev->curr_resync_completed;
1924
1925 }
1920 list_for_each_entry(rdev, &mddev->disks, same_set) { 1926 list_for_each_entry(rdev, &mddev->disks, same_set) {
1921 if (rdev->sb_events == mddev->events || 1927 if (rdev->sb_events == mddev->events ||
1922 (nospares && 1928 (nospares &&