aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-07-10 07:44:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:16 -0400
commitff4e8d9a9f46e3a7f89d14ade52fe5d53a82c022 (patch)
treee15fc4d8af0045a3947e3a25844773c6ee50289a /drivers/md/md.c
parent0b8c9de05c2a860fe6b02fedcb48763bcee648b3 (diff)
[PATCH] md: fix resync speed calculation for restarted resyncs
We introduced 'io_sectors' recently so we could count the sectors that causes io during resync separate from sectors which didn't cause IO - there can be a difference if a bitmap is being used to accelerate resync. However when a speed is reported, we find the number of sectors processed recently by subtracting an oldish io_sectors count from a current 'curr_resync' count. This is wrong because curr_resync counts all sectors, not just io sectors. So, add a field to mddev to store the curren io_sectors separately from curr_resync, and use that in the calculations. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fb50e5642c63..4bd3ccf363bd 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2719,7 +2719,7 @@ static ssize_t
2719sync_speed_show(mddev_t *mddev, char *page) 2719sync_speed_show(mddev_t *mddev, char *page)
2720{ 2720{
2721 unsigned long resync, dt, db; 2721 unsigned long resync, dt, db;
2722 resync = (mddev->curr_resync - atomic_read(&mddev->recovery_active)); 2722 resync = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active));
2723 dt = ((jiffies - mddev->resync_mark) / HZ); 2723 dt = ((jiffies - mddev->resync_mark) / HZ);
2724 if (!dt) dt++; 2724 if (!dt) dt++;
2725 db = resync - (mddev->resync_mark_cnt); 2725 db = resync - (mddev->resync_mark_cnt);
@@ -4687,12 +4687,13 @@ static void status_resync(struct seq_file *seq, mddev_t * mddev)
4687 */ 4687 */
4688 dt = ((jiffies - mddev->resync_mark) / HZ); 4688 dt = ((jiffies - mddev->resync_mark) / HZ);
4689 if (!dt) dt++; 4689 if (!dt) dt++;
4690 db = resync - (mddev->resync_mark_cnt/2); 4690 db = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active))
4691 rt = (dt * ((unsigned long)(max_blocks-resync) / (db/100+1)))/100; 4691 - mddev->resync_mark_cnt;
4692 rt = (dt * ((unsigned long)(max_blocks-resync) / (db/2/100+1)))/100;
4692 4693
4693 seq_printf(seq, " finish=%lu.%lumin", rt / 60, (rt % 60)/6); 4694 seq_printf(seq, " finish=%lu.%lumin", rt / 60, (rt % 60)/6);
4694 4695
4695 seq_printf(seq, " speed=%ldK/sec", db/dt); 4696 seq_printf(seq, " speed=%ldK/sec", db/2/dt);
4696} 4697}
4697 4698
4698static void *md_seq_start(struct seq_file *seq, loff_t *pos) 4699static void *md_seq_start(struct seq_file *seq, loff_t *pos)
@@ -5203,6 +5204,7 @@ void md_do_sync(mddev_t *mddev)
5203 5204
5204 j += sectors; 5205 j += sectors;
5205 if (j>1) mddev->curr_resync = j; 5206 if (j>1) mddev->curr_resync = j;
5207 mddev->curr_mark_cnt = io_sectors;
5206 if (last_check == 0) 5208 if (last_check == 0)
5207 /* this is the earliers that rebuilt will be 5209 /* this is the earliers that rebuilt will be
5208 * visible in /proc/mdstat 5210 * visible in /proc/mdstat