aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/md.c16
-rw-r--r--include/linux/raid/md_k.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 03b4cd0a6344..a99c50e217c0 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5716,19 +5716,19 @@ int unregister_md_personality(struct mdk_personality *p)
5716 return 0; 5716 return 0;
5717} 5717}
5718 5718
5719static int is_mddev_idle(mddev_t *mddev) 5719static int is_mddev_idle(mddev_t *mddev, int init)
5720{ 5720{
5721 mdk_rdev_t * rdev; 5721 mdk_rdev_t * rdev;
5722 int idle; 5722 int idle;
5723 long curr_events; 5723 int curr_events;
5724 5724
5725 idle = 1; 5725 idle = 1;
5726 rcu_read_lock(); 5726 rcu_read_lock();
5727 rdev_for_each_rcu(rdev, mddev) { 5727 rdev_for_each_rcu(rdev, mddev) {
5728 struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; 5728 struct gendisk *disk = rdev->bdev->bd_contains->bd_disk;
5729 curr_events = part_stat_read(&disk->part0, sectors[0]) + 5729 curr_events = (int)part_stat_read(&disk->part0, sectors[0]) +
5730 part_stat_read(&disk->part0, sectors[1]) - 5730 (int)part_stat_read(&disk->part0, sectors[1]) -
5731 atomic_read(&disk->sync_io); 5731 atomic_read(&disk->sync_io);
5732 /* sync IO will cause sync_io to increase before the disk_stats 5732 /* sync IO will cause sync_io to increase before the disk_stats
5733 * as sync_io is counted when a request starts, and 5733 * as sync_io is counted when a request starts, and
5734 * disk_stats is counted when it completes. 5734 * disk_stats is counted when it completes.
@@ -5751,7 +5751,7 @@ static int is_mddev_idle(mddev_t *mddev)
5751 * always make curr_events less than last_events. 5751 * always make curr_events less than last_events.
5752 * 5752 *
5753 */ 5753 */
5754 if (curr_events - rdev->last_events > 4096) { 5754 if (init || curr_events - rdev->last_events > 64) {
5755 rdev->last_events = curr_events; 5755 rdev->last_events = curr_events;
5756 idle = 0; 5756 idle = 0;
5757 } 5757 }
@@ -5994,7 +5994,7 @@ void md_do_sync(mddev_t *mddev)
5994 "(but not more than %d KB/sec) for %s.\n", 5994 "(but not more than %d KB/sec) for %s.\n",
5995 speed_max(mddev), desc); 5995 speed_max(mddev), desc);
5996 5996
5997 is_mddev_idle(mddev); /* this also initializes IO event counters */ 5997 is_mddev_idle(mddev, 1); /* this initializes IO event counters */
5998 5998
5999 io_sectors = 0; 5999 io_sectors = 0;
6000 for (m = 0; m < SYNC_MARKS; m++) { 6000 for (m = 0; m < SYNC_MARKS; m++) {
@@ -6096,7 +6096,7 @@ void md_do_sync(mddev_t *mddev)
6096 6096
6097 if (currspeed > speed_min(mddev)) { 6097 if (currspeed > speed_min(mddev)) {
6098 if ((currspeed > speed_max(mddev)) || 6098 if ((currspeed > speed_max(mddev)) ||
6099 !is_mddev_idle(mddev)) { 6099 !is_mddev_idle(mddev, 0)) {
6100 msleep(500); 6100 msleep(500);
6101 goto repeat; 6101 goto repeat;
6102 } 6102 }
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 9743e4dbc918..4aedb9fe2bd8 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -51,7 +51,7 @@ struct mdk_rdev_s
51 51
52 sector_t size; /* Device size (in blocks) */ 52 sector_t size; /* Device size (in blocks) */
53 mddev_t *mddev; /* RAID array if running */ 53 mddev_t *mddev; /* RAID array if running */
54 long last_events; /* IO event timestamp */ 54 int last_events; /* IO event timestamp */
55 55
56 struct block_device *bdev; /* block device handle */ 56 struct block_device *bdev; /* block device handle */
57 57