linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, lukasz.dorau@intel.com
Subject: [PATCH] imsm: fix checking completion of RAID10 resync
Date: Tue, 30 Jul 2013 15:59:25 +0200	[thread overview]
Message-ID: <20130730135925.30168.91570.stgit@localhost.localdomain> (raw)

If one creates RAID10 with IMSM metadata the is_resync_complete
function returns '1' just when initial resync reaches 50%

IMSM version of the is_resync_complete function has been added
that handles the case of IMSM RAID10 correctly.


Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
 super-intel.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 4df33f4..0371713 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1021,6 +1021,22 @@ static int is_failed(struct imsm_disk *disk)
 	return (disk->status & FAILED_DISK) == FAILED_DISK;
 }
 
+/* IMSM version of is_resync_complete helper routine
+ * to determine resync completion
+ * since MaxSector is a moving target
+ */
+static int imsm_is_resync_complete(struct mdinfo *array)
+{
+	if (array->array.level != 10) {
+		if (array->resync_start >= array->component_size)
+			return 1;
+	} else {
+		if (array->resync_start >= 2*array->component_size)
+			return 1;
+	}
+	return 0;
+}
+
 /* try to determine how much space is reserved for metadata from
  * the last get_extents() entry on the smallest active disk,
  * otherwise fallback to the default
@@ -7119,12 +7135,12 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
 		handle_missing(super, dev);
 
 	if (consistent == 2 &&
-	    (!is_resync_complete(&a->info) ||
+	    (!imsm_is_resync_complete(&a->info) ||
 	     map_state != IMSM_T_STATE_NORMAL ||
 	     dev->vol.migr_state))
 		consistent = 0;
 
-	if (is_resync_complete(&a->info)) {
+	if (imsm_is_resync_complete(&a->info)) {
 		/* complete intialization / resync,
 		 * recovery and interrupted recovery is completed in
 		 * ->set_disk


             reply	other threads:[~2013-07-30 13:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 13:59 Pawel Baldysiak [this message]
2013-07-30 23:22 ` [PATCH] imsm: fix checking completion of RAID10 resync NeilBrown
2013-08-01  8:46   ` Dorau, Lukasz
2013-08-01 12:32     ` Dorau, Lukasz
2013-08-05  5:43       ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130730135925.30168.91570.stgit@localhost.localdomain \
    --to=pawel.baldysiak@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=lukasz.dorau@intel.com \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).