+ md-fix-resync-speed-calculation-for-restarted-resyncs.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     md: fix resync speed calculation for restarted resyncs

has been added to the -mm tree.  Its filename is

     md-fix-resync-speed-calculation-for-restarted-resyncs.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: md: fix resync speed calculation for restarted resyncs
From: NeilBrown <neilb@xxxxxxx>

We introduced 'io_sectors' recently so we could count the sectors that causes
io during resync separate from sectors which didn't cause IO - there can be a
difference if a bitmap is being used to accelerate resync.

However when a speed is reported, we find the number of sectors processed
recently by subtracting an oldish io_sectors count from a current
'curr_resync' count.  This is wrong because curr_resync counts all sectors,
not just io sectors.

So, add a field to mddev to store the curren io_sectors separately from
curr_resync, and use that in the calculations.

Signed-off-by: Neil Brown <neilb@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/md/md.c           |   10 ++++++----
 drivers/md/raid5.c        |    3 ++-
 include/linux/raid/md_k.h |    3 ++-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff -puN drivers/md/md.c~md-fix-resync-speed-calculation-for-restarted-resyncs drivers/md/md.c
--- a/drivers/md/md.c~md-fix-resync-speed-calculation-for-restarted-resyncs
+++ a/drivers/md/md.c
@@ -2721,7 +2721,7 @@ static ssize_t
 sync_speed_show(mddev_t *mddev, char *page)
 {
 	unsigned long resync, dt, db;
-	resync = (mddev->curr_resync - atomic_read(&mddev->recovery_active));
+	resync = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active));
 	dt = ((jiffies - mddev->resync_mark) / HZ);
 	if (!dt) dt++;
 	db = resync - (mddev->resync_mark_cnt);
@@ -4692,12 +4692,13 @@ static void status_resync(struct seq_fil
 	 */
 	dt = ((jiffies - mddev->resync_mark) / HZ);
 	if (!dt) dt++;
-	db = resync - (mddev->resync_mark_cnt/2);
-	rt = (dt * ((unsigned long)(max_blocks-resync) / (db/100+1)))/100;
+	db = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active))
+		- mddev->resync_mark_cnt;
+	rt = (dt * ((unsigned long)(max_blocks-resync) / (db/2/100+1)))/100;
 
 	seq_printf(seq, " finish=%lu.%lumin", rt / 60, (rt % 60)/6);
 
-	seq_printf(seq, " speed=%ldK/sec", db/dt);
+	seq_printf(seq, " speed=%ldK/sec", db/2/dt);
 }
 
 static void *md_seq_start(struct seq_file *seq, loff_t *pos)
@@ -5208,6 +5209,7 @@ void md_do_sync(mddev_t *mddev)
 
 		j += sectors;
 		if (j>1) mddev->curr_resync = j;
+		mddev->curr_mark_cnt = io_sectors;
 		if (last_check == 0)
 			/* this is the earliers that rebuilt will be
 			 * visible in /proc/mdstat
diff -puN drivers/md/raid5.c~md-fix-resync-speed-calculation-for-restarted-resyncs drivers/md/raid5.c
--- a/drivers/md/raid5.c~md-fix-resync-speed-calculation-for-restarted-resyncs
+++ a/drivers/md/raid5.c
@@ -282,7 +282,8 @@ static struct stripe_head *get_active_st
 			} else {
 				if (!test_bit(STRIPE_HANDLE, &sh->state))
 					atomic_inc(&conf->active_stripes);
-				if (list_empty(&sh->lru))
+				if (list_empty(&sh->lru) &&
+				    !test_bit(STRIPE_EXPANDING, &sh->state))
 					BUG();
 				list_del_init(&sh->lru);
 			}
diff -puN include/linux/raid/md_k.h~md-fix-resync-speed-calculation-for-restarted-resyncs include/linux/raid/md_k.h
--- a/include/linux/raid/md_k.h~md-fix-resync-speed-calculation-for-restarted-resyncs
+++ a/include/linux/raid/md_k.h
@@ -148,9 +148,10 @@ struct mddev_s
 
 	struct mdk_thread_s		*thread;	/* management thread */
 	struct mdk_thread_s		*sync_thread;	/* doing resync or reconstruct */
-	sector_t			curr_resync;	/* blocks scheduled */
+	sector_t			curr_resync;	/* last block scheduled */
 	unsigned long			resync_mark;	/* a recent timestamp */
 	sector_t			resync_mark_cnt;/* blocks written at resync_mark */
+	sector_t			curr_mark_cnt; /* blocks scheduled now */
 
 	sector_t			resync_max_sectors; /* may be set by personality */
 
_

Patches currently in -mm which might be from neilb@xxxxxxx are

origin.patch
generic_file_buffered_write-deadlock-on-vectored-write.patch
md-possible-fix-for-unplug-problem.patch
md-set-desc_nr-correctly-for-version-1-superblocks.patch
md-delay-starting-md-threads-until-array-is-completely-setup.patch
md-fix-resync-speed-calculation-for-restarted-resyncs.patch
md-fix-a-plug-unplug-race-in-raid5.patch
md-fix-some-small-races-in-bitmap-plugging-in-raid5.patch
md-fix-usage-of-wrong-variable-in-raid1.patch
md-unify-usage-of-symbolic-names-for-perms.patch
md-require-cap_sys_admin-for-re-configuring-md-devices-via-sysfs.patch
md-fix-will-configure-message-when-interpreting-md=-kernel-parameter.patch
md-include-sector-number-in-messages-about-corrected-read-errors.patch
md-dm-reduce-stack-usage-with-stacked-block-devices.patch
lockdep-annotate-sunrpc-code.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux