aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/md.c10
-rw-r--r--drivers/md/raid5.c3
-rw-r--r--include/linux/raid/md_k.h3
3 files changed, 10 insertions, 6 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
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index a02f35f1a796..dd0d00108a31 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -281,7 +281,8 @@ static struct stripe_head *get_active_stripe(raid5_conf_t *conf, sector_t sector
281 } else { 281 } else {
282 if (!test_bit(STRIPE_HANDLE, &sh->state)) 282 if (!test_bit(STRIPE_HANDLE, &sh->state))
283 atomic_inc(&conf->active_stripes); 283 atomic_inc(&conf->active_stripes);
284 if (list_empty(&sh->lru)) 284 if (list_empty(&sh->lru) &&
285 !test_bit(STRIPE_EXPANDING, &sh->state))
285 BUG(); 286 BUG();
286 list_del_init(&sh->lru); 287 list_del_init(&sh->lru);
287 } 288 }
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index c1e0ac55bab5..d28890295852 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -148,9 +148,10 @@ struct mddev_s
148 148
149 struct mdk_thread_s *thread; /* management thread */ 149 struct mdk_thread_s *thread; /* management thread */
150 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ 150 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
151 sector_t curr_resync; /* blocks scheduled */ 151 sector_t curr_resync; /* last block scheduled */
152 unsigned long resync_mark; /* a recent timestamp */ 152 unsigned long resync_mark; /* a recent timestamp */
153 sector_t resync_mark_cnt;/* blocks written at resync_mark */ 153 sector_t resync_mark_cnt;/* blocks written at resync_mark */
154 sector_t curr_mark_cnt; /* blocks scheduled now */
154 155
155 sector_t resync_max_sectors; /* may be set by personality */ 156 sector_t resync_max_sectors; /* may be set by personality */
156 157