diff options
| -rw-r--r-- | drivers/md/md.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index f3fed662f32e..78c7418478d6 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -3846,11 +3846,20 @@ static int is_mddev_idle(mddev_t *mddev) | |||
| 3846 | curr_events = disk_stat_read(disk, sectors[0]) + | 3846 | curr_events = disk_stat_read(disk, sectors[0]) + |
| 3847 | disk_stat_read(disk, sectors[1]) - | 3847 | disk_stat_read(disk, sectors[1]) - |
| 3848 | atomic_read(&disk->sync_io); | 3848 | atomic_read(&disk->sync_io); |
| 3849 | /* Allow some slack between valud of curr_events and last_events, | 3849 | /* The difference between curr_events and last_events |
| 3850 | * as there are some uninteresting races. | 3850 | * will be affected by any new non-sync IO (making |
| 3851 | * curr_events bigger) and any difference in the amount of | ||
| 3852 | * in-flight syncio (making current_events bigger or smaller) | ||
| 3853 | * The amount in-flight is currently limited to | ||
| 3854 | * 32*64K in raid1/10 and 256*PAGE_SIZE in raid5/6 | ||
| 3855 | * which is at most 4096 sectors. | ||
| 3856 | * These numbers are fairly fragile and should be made | ||
| 3857 | * more robust, probably by enforcing the | ||
| 3858 | * 'window size' that md_do_sync sort-of uses. | ||
| 3859 | * | ||
| 3851 | * Note: the following is an unsigned comparison. | 3860 | * Note: the following is an unsigned comparison. |
| 3852 | */ | 3861 | */ |
| 3853 | if ((curr_events - rdev->last_events + 32) > 64) { | 3862 | if ((curr_events - rdev->last_events + 4096) > 8192) { |
| 3854 | rdev->last_events = curr_events; | 3863 | rdev->last_events = curr_events; |
| 3855 | idle = 0; | 3864 | idle = 0; |
| 3856 | } | 3865 | } |
| @@ -4109,7 +4118,7 @@ static void md_do_sync(mddev_t *mddev) | |||
| 4109 | if (currspeed > sysctl_speed_limit_min) { | 4118 | if (currspeed > sysctl_speed_limit_min) { |
| 4110 | if ((currspeed > sysctl_speed_limit_max) || | 4119 | if ((currspeed > sysctl_speed_limit_max) || |
| 4111 | !is_mddev_idle(mddev)) { | 4120 | !is_mddev_idle(mddev)) { |
| 4112 | msleep(250); | 4121 | msleep(500); |
| 4113 | goto repeat; | 4122 | goto repeat; |
| 4114 | } | 4123 | } |
| 4115 | } | 4124 | } |
