All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, wojciech.neubauer@intel.com,
	adam.kwolek@intel.com, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com
Subject: [PATCH 12/22] imsm: update blocks_per_migr_unit() to support migration record
Date: Thu, 02 Jun 2011 16:49:51 +0200	[thread overview]
Message-ID: <20110602144951.27355.24237.stgit@gklab-128-111.igk.intel.com> (raw)
In-Reply-To: <20110602144212.27355.3706.stgit@gklab-128-111.igk.intel.com>

From: Adam Kwolek <adam.kwolek@intel.com>

blocks_per_migr_unit() has to use information from migration record
for general migration case. This causes to pass intel_super pointer
to this function and some other interfaces changes.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
---
 super-intel.c |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index c40c02a..d80e530 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -915,9 +915,13 @@ static unsigned long long min_acceptable_spare_size_imsm(struct supertype *st)
 }
 
 #ifndef MDASSEMBLE
-static __u64 blocks_per_migr_unit(struct imsm_dev *dev);
+static __u64 blocks_per_migr_unit(struct intel_super *super,
+				  struct imsm_dev *dev);
 
-static void print_imsm_dev(struct imsm_dev *dev, char *uuid, int disk_idx)
+static void print_imsm_dev(struct intel_super *super,
+			   struct imsm_dev *dev,
+			   char *uuid,
+			   int disk_idx)
 {
 	__u64 sz;
 	int slot, i;
@@ -1008,7 +1012,7 @@ static void print_imsm_dev(struct imsm_dev *dev, char *uuid, int disk_idx)
 		printf(" <-- %s", map_state_str[map->map_state]);
 		printf("\n     Checkpoint : %u (%llu)",
 		       __le32_to_cpu(dev->vol.curr_migr_unit),
-		       (unsigned long long)blocks_per_migr_unit(dev));
+		       (unsigned long long)blocks_per_migr_unit(super, dev));
 	}
 	printf("\n");
 	printf("    Dirty State : %s\n", dev->vol.dirty ? "dirty" : "clean");
@@ -1138,7 +1142,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
 		info.devs = NULL;
 		getinfo_super_imsm(st, &info, NULL);
 		fname_from_uuid(st, &info, nbuf, ':');
-		print_imsm_dev(dev, nbuf + 5, super->disks->index);
+		print_imsm_dev(super, dev, nbuf + 5, super->disks->index);
 	}
 	for (i = 0; i < mpb->num_disks; i++) {
 		if (i == super->disks->index)
@@ -1784,7 +1788,8 @@ static __u32 map_migr_block(struct imsm_dev *dev, __u32 block)
 	}
 }
 
-static __u64 blocks_per_migr_unit(struct imsm_dev *dev)
+static __u64 blocks_per_migr_unit(struct intel_super *super,
+				  struct imsm_dev *dev)
 {
 	/* calculate the conversion factor between per member 'blocks'
 	 * (md/{resync,rebuild}_start) and imsm migration units, return
@@ -1794,7 +1799,10 @@ static __u64 blocks_per_migr_unit(struct imsm_dev *dev)
 		return 0;
 
 	switch (migr_type(dev)) {
-	case MIGR_GEN_MIGR:
+	case MIGR_GEN_MIGR: {
+		struct migr_record *migr_rec = super->migr_rec;
+		return __le32_to_cpu(migr_rec->blocks_per_unit);
+	}
 	case MIGR_VERIFY:
 	case MIGR_REPAIR:
 	case MIGR_INIT: {
@@ -1992,6 +2000,7 @@ static int write_imsm_migr_rec(struct supertype *st)
 static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info, char *dmap)
 {
 	struct intel_super *super = st->sb;
+	struct migr_record *migr_rec = super->migr_rec;
 	struct imsm_dev *dev = get_imsm_dev(super, super->current_vol);
 	struct imsm_map *map = get_imsm_map(dev, 0);
 	struct imsm_map *prev_map = get_imsm_map(dev, 1);
@@ -2106,15 +2115,17 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
 		switch (migr_type(dev)) {
 		case MIGR_REPAIR:
 		case MIGR_INIT: {
-			__u64 blocks_per_unit = blocks_per_migr_unit(dev);
+			__u64 blocks_per_unit = blocks_per_migr_unit(super,
+								     dev);
 			__u64 units = __le32_to_cpu(dev->vol.curr_migr_unit);
 
 			info->resync_start = blocks_per_unit * units;
 			break;
 		}
 		case MIGR_GEN_MIGR: {
-			__u64 blocks_per_unit = blocks_per_migr_unit(dev);
-			__u64 units = __le32_to_cpu(dev->vol.curr_migr_unit);
+			__u64 blocks_per_unit = blocks_per_migr_unit(super,
+								     dev);
+			__u64 units = __le32_to_cpu(migr_rec->curr_migr_unit);
 			unsigned long long array_blocks;
 			int used_disks;
 
@@ -5256,7 +5267,9 @@ static int is_rebuilding(struct imsm_dev *dev)
 		return 0;
 }
 
-static void update_recovery_start(struct imsm_dev *dev, struct mdinfo *array)
+static void update_recovery_start(struct intel_super *super,
+					struct imsm_dev *dev,
+					struct mdinfo *array)
 {
 	struct mdinfo *rebuild = NULL;
 	struct mdinfo *d;
@@ -5283,7 +5296,7 @@ static void update_recovery_start(struct imsm_dev *dev, struct mdinfo *array)
 	}
 
 	units = __le32_to_cpu(dev->vol.curr_migr_unit);
-	rebuild->recovery_start = units * blocks_per_migr_unit(dev);
+	rebuild->recovery_start = units * blocks_per_migr_unit(super, dev);
 }
 
 
@@ -5447,7 +5460,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 			info_d->component_size = __le32_to_cpu(map->blocks_per_member);
 		}
 		/* now that the disk list is up-to-date fixup recovery_start */
-		update_recovery_start(dev, this);
+		update_recovery_start(super, dev, this);
 		this->array.spare_disks += spare_disks;
 		rest = this;
 	}
@@ -5839,7 +5852,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
 
 mark_checkpoint:
 	/* check if we can update curr_migr_unit from resync_start, recovery_start */
-	blocks_per_unit = blocks_per_migr_unit(dev);
+	blocks_per_unit = blocks_per_migr_unit(super, dev);
 	if (blocks_per_unit) {
 		__u32 units32;
 		__u64 units;
@@ -8623,9 +8636,10 @@ static int imsm_manage_reshape(
 		sysfs_set_num(sra, NULL, "suspend_hi", next_step);
 
 		/* wait until reshape finish */
-		if (wait_for_reshape_imsm(sra, next_step, ndata) < 0)
-			dprintf("wait_for_reshape_imsm returned error,"
-				" but we ignore it!\n");
+		if (wait_for_reshape_imsm(sra, next_step, ndata) < 0) {
+			dprintf("wait_for_reshape_imsm returned error!\n");
+			goto abort;
+		}
 
 		sra->reshape_progress = next_step;
 


  parent reply	other threads:[~2011-06-02 14:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 14:48 [PATCH 00/22] IMSM checkpointing implementation Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 01/22] imsm: Add migration record to intel_super Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 02/22] Support restore_stripes() from the given buffer Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 03/22] Define dummy functions to mdmon.c Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 04/22] imsm: Add support for copy area and backup operations Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 05/22] imsm: check migration compatibility Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 06/22] FIX: Initialize reshape structure Krzysztof Wojcik
2011-06-08  6:54   ` NeilBrown
2011-06-02 14:49 ` [PATCH 07/22] imsm: Add wait_for_reshape_imsm() implementation Krzysztof Wojcik
2011-06-08  7:07   ` NeilBrown
2011-06-02 14:49 ` [PATCH 08/22] imsm: Implement imsm_manage_reshape(), reshape workhorse Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 09/22] imsm: Check if array degradation has been changed Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 10/22] imsm: Clear migration record when no migration in progress Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 11/22] imsm: Add information about migration record to mdadm '-E' option Krzysztof Wojcik
2011-06-02 14:49 ` Krzysztof Wojcik [this message]
2011-06-02 14:49 ` [PATCH 13/22] Add reshape restart support for external metadata Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 14/22] imsm: Implement recover_backup_imsm() for imsm metadata Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 15/22] imsm: Disable checkpoint updating by mdmon for general migration Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 16/22] imsm: Add metadata update type for general migration check-pointing Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 17/22] imsm: Prepare checkpoint update for general migration Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 18/22] imsm: Apply checkpoint metadata " Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 19/22] FIX: Enable metadata updates for raid0 Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 20/22] Do not use backup file for external metadata Krzysztof Wojcik
2011-06-02 14:51 ` [PATCH 21/22] imsm: Remove user warning before reshape start Krzysztof Wojcik
2011-06-02 14:51 ` [PATCH 22/22] imsm: Unit Tests - remove backup-file during grow command Krzysztof Wojcik
2011-06-08  7:23 ` [PATCH 00/22] IMSM checkpointing implementation NeilBrown
2011-06-08  7:34   ` Wojcik, Krzysztof

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=20110602144951.27355.24237.stgit@gklab-128-111.igk.intel.com \
    --to=krzysztof.wojcik@intel.com \
    --cc=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.