diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-23 03:21:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-23 03:21:15 -0400 |
commit | 58ee01007c9e00531c1280b2d99b49d29a5e9844 (patch) | |
tree | d1feb7102591a811b4458e2e209d476580ae3687 /drivers/md/md.c | |
parent | 4850f26abfcac9ed28a4db5817b46dc0bfbbbae0 (diff) | |
parent | 4b972a01a7da614b4796475f933094751a295a2f (diff) |
Merge 5.2-rc6 into usb-next
We need the USB fixes in here too.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 04f4f131f9d6..9801d540fea1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7607,9 +7607,9 @@ static void status_unused(struct seq_file *seq) | |||
7607 | static int status_resync(struct seq_file *seq, struct mddev *mddev) | 7607 | static int status_resync(struct seq_file *seq, struct mddev *mddev) |
7608 | { | 7608 | { |
7609 | sector_t max_sectors, resync, res; | 7609 | sector_t max_sectors, resync, res; |
7610 | unsigned long dt, db; | 7610 | unsigned long dt, db = 0; |
7611 | sector_t rt; | 7611 | sector_t rt, curr_mark_cnt, resync_mark_cnt; |
7612 | int scale; | 7612 | int scale, recovery_active; |
7613 | unsigned int per_milli; | 7613 | unsigned int per_milli; |
7614 | 7614 | ||
7615 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) || | 7615 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) || |
@@ -7698,22 +7698,30 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev) | |||
7698 | * db: blocks written from mark until now | 7698 | * db: blocks written from mark until now |
7699 | * rt: remaining time | 7699 | * rt: remaining time |
7700 | * | 7700 | * |
7701 | * rt is a sector_t, so could be 32bit or 64bit. | 7701 | * rt is a sector_t, which is always 64bit now. We are keeping |
7702 | * So we divide before multiply in case it is 32bit and close | 7702 | * the original algorithm, but it is not really necessary. |
7703 | * to the limit. | 7703 | * |
7704 | * We scale the divisor (db) by 32 to avoid losing precision | 7704 | * Original algorithm: |
7705 | * near the end of resync when the number of remaining sectors | 7705 | * So we divide before multiply in case it is 32bit and close |
7706 | * is close to 'db'. | 7706 | * to the limit. |
7707 | * We then divide rt by 32 after multiplying by db to compensate. | 7707 | * We scale the divisor (db) by 32 to avoid losing precision |
7708 | * The '+1' avoids division by zero if db is very small. | 7708 | * near the end of resync when the number of remaining sectors |
7709 | * is close to 'db'. | ||
7710 | * We then divide rt by 32 after multiplying by db to compensate. | ||
7711 | * The '+1' avoids division by zero if db is very small. | ||
7709 | */ | 7712 | */ |
7710 | dt = ((jiffies - mddev->resync_mark) / HZ); | 7713 | dt = ((jiffies - mddev->resync_mark) / HZ); |
7711 | if (!dt) dt++; | 7714 | if (!dt) dt++; |
7712 | db = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active)) | 7715 | |
7713 | - mddev->resync_mark_cnt; | 7716 | curr_mark_cnt = mddev->curr_mark_cnt; |
7717 | recovery_active = atomic_read(&mddev->recovery_active); | ||
7718 | resync_mark_cnt = mddev->resync_mark_cnt; | ||
7719 | |||
7720 | if (curr_mark_cnt >= (recovery_active + resync_mark_cnt)) | ||
7721 | db = curr_mark_cnt - (recovery_active + resync_mark_cnt); | ||
7714 | 7722 | ||
7715 | rt = max_sectors - resync; /* number of remaining sectors */ | 7723 | rt = max_sectors - resync; /* number of remaining sectors */ |
7716 | sector_div(rt, db/32+1); | 7724 | rt = div64_u64(rt, db/32+1); |
7717 | rt *= dt; | 7725 | rt *= dt; |
7718 | rt >>= 5; | 7726 | rt >>= 5; |
7719 | 7727 | ||