linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: Re: [PATCH 5/9] imsm: Update metadata for second array
Date: Wed, 12 Jan 2011 16:48:34 +1100	[thread overview]
Message-ID: <20110112164834.2de9f413@notabene.brown> (raw)
In-Reply-To: <20110111140427.13862.29204.stgit@gklab-128-013.igk.intel.com>

On Tue, 11 Jan 2011 15:04:27 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:

> When second array reshape is about to start metadata should be updated
> by mdmon in imsm_set_array_state().
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  super-intel.c |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 77 insertions(+), 0 deletions(-)
> 
> diff --git a/super-intel.c b/super-intel.c
> index 321dc47..1db15c2 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -5069,6 +5069,83 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
>  
>  		for (mdi = a->info.devs; mdi; mdi = mdi->next)
>  			imsm_set_disk(a, mdi->disk.raid_disk, mdi->curr_state);
> +	} else if (dev->vol.migr_state == 0) {
> +		/* check here if this is container action
> +		 * and next metadata should be prepared
> +		*/
> +		struct active_array *aa = a->container->arrays;
> +		int arrays_under_reshape = 0;
> +
> +		/* check if no other arrays is under reshape
> +		 */
> +		while (aa) {
> +			if (aa->container) {
> +				int inst = aa->info.container_member;
> +				struct intel_super *super = aa->container->sb;
> +				struct imsm_dev *dev =
> +						get_imsm_dev(super, inst);
> +				struct imsm_map *map2 = get_imsm_map(dev, 1);
> +
> +				if (map2)
> +					arrays_under_reshape++;
> +			}
> +			aa = aa->next;
> +		}
> +		if (arrays_under_reshape == 0) {
> +			struct imsm_map *map = get_imsm_map(dev, 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->num_members) {
> +				/* manage changes in volume
> +				 */
> +				struct imsm_map *map, *map2;
> +				int prev_num_members;
> +				int used_disks;
> +				int i;
> +
> +				map = get_imsm_map(dev, 0);
> +				prev_num_members = map->num_members;
> +				map->num_members = disks_count;
> +				dev->vol.migr_state = 1;
> +				dev->vol.curr_migr_unit = 0;
> +				dev->vol.migr_type = MIGR_GEN_MIGR;
> +				for (i = prev_num_members;
> +					i < map->num_members; i++)
> +					set_imsm_ord_tbl_ent(map, i, i);
> +				map2 = get_imsm_map(dev, 1);
> +				/* Copy the current map */
> +				memcpy(map2, map, sizeof_imsm_map(map));
> +				map2->num_members = prev_num_members;
> +
> +				/* calculate new size
> +				 */
> +				used_disks = imsm_num_data_members(dev, 0);
> +				if (used_disks) {
> +					unsigned long long array_blocks;
> +
> +					array_blocks =
> +						map->blocks_per_member
> +						* used_disks;
> +					/* round array size down to closest MB
> +					 */
> +					array_blocks = (array_blocks
> +							>> SECT_PER_MB_SHIFT)
> +							<< SECT_PER_MB_SHIFT;
> +					dev->size_low =
> +					     __cpu_to_le32((__u32)array_blocks);
> +					dev->size_high =
> +						__cpu_to_le32(
> +						(__u32)(array_blocks >> 32));
> +				}
> +				super->updates_pending++;
> +			}
> +		}
>  	}
>  
>  	return consistent;


Most of this code is identical to  imsm_progress_container_reshape.
Maybe you just want to put another call to that function in somewhere.

NeilBrown


  reply	other threads:[~2011-01-12  5:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 14:03 [PATCH 0/9] OLCE for external meta (cont.) Adam Kwolek
2011-01-11 14:03 ` [PATCH 1/9] imsm: FIX: set correct slot information in metadata (raid0) Adam Kwolek
2011-01-11 14:04 ` [PATCH 2/9] FIX: Cannot add spare to monitored container Adam Kwolek
2011-01-12  5:43   ` NeilBrown
2011-01-12 15:57     ` Kwolek, Adam
2011-01-13  3:07       ` NeilBrown
2011-01-13 15:15         ` Czarnowska, Anna
2011-01-11 14:04 ` [PATCH 3/9] imsm:FIX: one spare can be added to raid0 only Adam Kwolek
2011-01-12  5:44   ` NeilBrown
2011-01-12 15:15     ` Kwolek, Adam
2011-01-11 14:04 ` [PATCH 4/9] imsm: FIX: only one spare is passed in update Adam Kwolek
2011-01-12  5:46   ` NeilBrown
2011-01-11 14:04 ` [PATCH 5/9] imsm: Update metadata for second array Adam Kwolek
2011-01-12  5:48   ` NeilBrown [this message]
2011-01-11 14:04 ` [PATCH 6/9] imsm: FIX: container content gathering is not needed for size set Adam Kwolek
2011-01-12  5:52   ` NeilBrown
2011-01-12 15:30     ` Kwolek, Adam
2011-01-13  3:04       ` NeilBrown
2011-01-11 14:04 ` [PATCH 7/9] imsm: FIX: monitor should initialize 2nd reshape only Adam Kwolek
2011-01-12  5:57   ` NeilBrown
2011-01-11 14:04 ` [PATCH 8/9] FIX: container has to be frozen during reshape Adam Kwolek
2011-01-11 14:04 ` [PATCH 9/9] imsm: Proceed with second array reshape only for frozen container Adam Kwolek
2011-01-11 15:23 ` [PATCH 0/4] RAID 0 to/from RAID5 migration Labun, Marcin

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=20110112164834.2de9f413@notabene.brown \
    --to=neilb@suse.de \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --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 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).