All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Kwolek <adam.kwolek@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: [PATCH 1/4] imsm: Update metadata for second array
Date: Thu, 20 Jan 2011 11:57:22 +0100	[thread overview]
Message-ID: <20110120105722.22926.92369.stgit@gklab-128-013.igk.intel.com> (raw)
In-Reply-To: <20110120104759.22926.66874.stgit@gklab-128-013.igk.intel.com>

When second array reshape is about to start external metadata should be updated
by mdmon in imsm_set_array_state().
for this purposes imsm_progress_container_reshape() is reused.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---

 super-intel.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index d86e8d8..7f907ef 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4863,7 +4863,9 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
 
 static void imsm_set_disk(struct active_array *a, int n, int state);
 
-static void imsm_progress_container_reshape(struct intel_super *super)
+static void imsm_progress_container_reshape(struct intel_super *super,
+					    struct imsm_dev *dev_in,
+					    int disk_count)
 {
 	/* if no device has a migr_state, but some device has a
 	 * different number of members than the previous device, start
@@ -4871,7 +4873,7 @@ static void imsm_progress_container_reshape(struct intel_super *super)
 	 * previous.
 	 */
 	struct imsm_super *mpb = super->anchor;
-	int prev_disks = -1;
+	int prev_disks = disk_count;
 	int i;
 
 	for (i = 0; i < mpb->num_raid_devs; i++) {
@@ -4884,6 +4886,10 @@ static void imsm_progress_container_reshape(struct intel_super *super)
 		if (dev->vol.migr_state)
 			return;
 
+		if (((dev_in != NULL) && disk_count > 0) &&
+		     (dev_in != dev))
+			continue;
+
 		if (prev_disks == -1)
 			prev_disks = map->num_members;
 		if (prev_disks == map->num_members)
@@ -4999,7 +5005,9 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
 						       * array size
 						       */
 				super->updates_pending++;
-				imsm_progress_container_reshape(super);
+				imsm_progress_container_reshape(super,
+								NULL,
+								-1);
 			}				
 		}
 	}
@@ -5065,13 +5073,47 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
 		super->updates_pending++;
 	}
 
-	/* finalize online capacity expansion/reshape */
 	if ((a->curr_action != reshape) &&
 	    (a->prev_action == reshape)) {
 		struct mdinfo *mdi;
+		struct imsm_dev *dev_next;
+		int next_inst;
 
+
+		/* finalize online capacity expansion/reshape */
 		for (mdi = a->info.devs; mdi; mdi = mdi->next)
 			imsm_set_disk(a, mdi->disk.raid_disk, mdi->curr_state);
+
+		/* check next volume reshape
+		 * 2 volumes support only
+		 * for more volumes supported next_inst should be found
+		 * in another way
+		 */
+		next_inst = inst ? 0 : 1;
+		dev_next = get_imsm_dev(super, next_inst);
+		if (dev_next && dev_next->vol.migr_state == 0) {
+			/* check here if this is container action
+			* and next metadata should be prepared
+			*/
+			struct imsm_map *map_next = get_imsm_map(dev_next, 0);
+			struct dl *dl = NULL;
+			int disks_count = 0;
+
+			/* check if this array should be reshaped
+			*/
+			for (dl = super->disks; dl; dl = dl->next)
+				if (dl->index >= 0)
+					disks_count++;
+
+			if (disks_count > map_next->num_members) {
+				/* manage changes in volume
+				*/
+				imsm_progress_container_reshape(super,
+							dev_next,
+							disks_count);
+				super->updates_pending++;
+			}
+		}
 	}
 
 	return consistent;


  reply	other threads:[~2011-01-20 10:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-20 10:57 [PATCH 0/4] OLCE continue reshape for all arrays in container (rebased) Adam Kwolek
2011-01-20 10:57 ` Adam Kwolek [this message]
2011-01-26  5:33   ` [PATCH 1/4] imsm: Update metadata for second array Neil Brown
2011-01-20 10:57 ` [PATCH 2/4] imsm: FIX: spare cannot be added Adam Kwolek
2011-01-27  3:02   ` Neil Brown
2011-01-27  7:59     ` Kwolek, Adam
2011-01-20 10:57 ` [PATCH 3/4] FIX: monitor doesn't handshake with md Adam Kwolek
2011-01-27  3:03   ` Neil Brown
2011-01-27  7:57     ` Kwolek, Adam
2011-01-20 10:57 ` [PATCH 4/4] WORKAROUND: mdadm hangs during reshape Adam Kwolek
2011-01-27  3:05   ` Neil Brown

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=20110120105722.22926.92369.stgit@gklab-128-013.igk.intel.com \
    --to=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=wojciech.neubauer@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.