summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorXiao Ni <xni@redhat.com>2014-08-07 15:37:41 +0200
committerNeilBrown <neilb@suse.de>2014-08-08 04:11:25 +0200
commitac7e50a3835de2321bcc511e4b6fe736c73c830f (patch)
tree9041467bee34379e121835b03fe81bff383136ea /drivers/md
parentmd: disable probing for md devices 512 and over. (diff)
downloadlinux-ac7e50a3835de2321bcc511e4b6fe736c73c830f.tar.xz
linux-ac7e50a3835de2321bcc511e4b6fe736c73c830f.zip
md: Recovery speed is wrong
When we calculate the speed of recovery, the numerator that contains the recovery done sectors. It's need to subtract the sectors which don't finish recovery. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1379b1a3b9ff..eb8c93dff7c6 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7376,7 +7376,7 @@ void md_do_sync(struct md_thread *thread)
struct mddev *mddev2;
unsigned int currspeed = 0,
window;
- sector_t max_sectors,j, io_sectors;
+ sector_t max_sectors,j, io_sectors, recovery_done;
unsigned long mark[SYNC_MARKS];
unsigned long update_time;
sector_t mark_cnt[SYNC_MARKS];
@@ -7652,7 +7652,8 @@ void md_do_sync(struct md_thread *thread)
*/
cond_resched();
- currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2
+ recovery_done = io_sectors - atomic_read(&mddev->recovery_active);
+ currspeed = ((unsigned long)(recovery_done - mddev->resync_mark_cnt))/2
/((jiffies-mddev->resync_mark)/HZ +1) +1;
if (currspeed > speed_min(mddev)) {