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, ed.ciechanowski@intel.com,
	marcin.labun@intel.com, dan.j.williams@intel.com
Subject: Re: [PATCH 1/3] Always run Grow_continue() for started array.
Date: Wed, 5 Oct 2011 13:59:09 +1100	[thread overview]
Message-ID: <20111005135909.13fe29d9@notabene.brown> (raw)
In-Reply-To: <20111004155349.27434.70639.stgit@gklab-128-013.igk.intel.com>

[-- Attachment #1: Type: text/plain, Size: 4310 bytes --]

On Tue, 04 Oct 2011 17:53:49 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:

> So far there were 2 reshape continuation cases:
>  1. array is started /e.g. reshape was already invoked during initrd
>                       start-up stage using "--freeze-reshape" option/
>  2. array is not started yet /"normal" assembling array under reshape case/
> 
> This patch narrows continuation cases in to single one. To do this
> array should be started /set readonly in to array_state/ before calling
> Grow_continue() function.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>

I mostly like this patch.
However it seems to have lost something in Grow_continue.
The distinction between ->reshape_active==1 and ->reshape_active==2
is lost.

==1 means just this array is in the middle of a reshape.
==2 means that the whole container is being reshaped and after this array
is done we need to move on to the next one.

Was there are reason you removed that?  If not, please put it back.

Thanks,
NeilBrown


> ---
> 
>  Assemble.c |   17 +++++++++++++----
>  Grow.c     |   43 +++++++++++++++++++------------------------
>  2 files changed, 32 insertions(+), 28 deletions(-)
> 
> diff --git a/Assemble.c b/Assemble.c
> index 4511f4d..0d3730b 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -1343,10 +1343,14 @@ int Assemble(struct supertype *st, char *mddev,
>  			int rv;
>  #ifndef MDASSEMBLE
>  			if (content->reshape_active &&
> -			    content->delta_disks <= 0)
> -				rv = Grow_continue(mdfd, st, content,
> -						   backup_file, freeze_reshape);
> -			else
> +			    content->delta_disks <= 0) {
> +				rv = sysfs_set_str(content, NULL,
> +						   "array_state", "readonly");
> +				if (rv == 0)
> +					rv = Grow_continue(mdfd, st, content,
> +							   backup_file,
> +							   freeze_reshape);
> +			} else
>  #endif
>  				rv = ioctl(mdfd, RUN_ARRAY, NULL);
>  			if (rv == 0) {
> @@ -1561,6 +1565,11 @@ int assemble_container_content(struct supertype *st, int mdfd,
>  					   spare, backup_file, verbose) == 1)
>  				return 1;
>  
> +			err = sysfs_set_str(content, NULL,
> +					    "array_state", "readonly");
> +			if (err)
> +				return 1;
> +
>  			err = Grow_continue(mdfd, st, content, backup_file,
>  					    freeze_reshape);
>  		} else switch(content->array.level) {
> diff --git a/Grow.c b/Grow.c
> index 0b58d5e..076375a 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -3797,33 +3797,28 @@ Grow_continue_command_exit:
>  int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
>  		  char *backup_file, int freeze_reshape)
>  {
> -	char buf[40];
> -	char *container = NULL;
> -	int err;
> +	int ret_val = 2;
> +
> +	if (!info->reshape_active)
> +		return ret_val;
>  
> -	err = sysfs_set_str(info, NULL, "array_state", "readonly");
> -	if (err)
> -		return err;
>  	if (st->ss->external) {
> -		fmt_devname(buf, st->container_dev);
> -		container = buf;
> +		char container[40];
> +		int cfd = open_dev(st->container_dev);
>  
> -		if (!mdmon_running(st->container_dev))
> -			start_mdmon(st->container_dev);
> -		ping_monitor_by_id(st->container_dev);
> +		if (cfd < 0)
> +			return 1;
>  
> +		fmt_devname(container, st->container_dev);
> +		st->ss->load_container(st, cfd, container);
> +		close(cfd);
> +		ret_val = reshape_container(container, NULL,
> +					    st, info, 0, backup_file,
> +					    0, 1, freeze_reshape);
> +	} else
> +		ret_val = reshape_array(NULL, mdfd, "array", st, info, 1,
> +					NULL, backup_file, 0, 0, 1,
> +					freeze_reshape);
>  
> -		if (info->reshape_active == 2) {
> -			int cfd = open_dev(st->container_dev);
> -			if (cfd < 0)
> -				return 1;
> -			st->ss->load_container(st, cfd, container);
> -			close(cfd);
> -			return reshape_container(container, NULL,
> -						 st, info, 0, backup_file,
> -						 0, 1, freeze_reshape);
> -		}
> -	}
> -	return reshape_array(container, mdfd, "array", st, info, 1,
> -			     NULL, backup_file, 0, 0, 1, freeze_reshape);
> +	return ret_val;
>  }
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2011-10-05  2:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 15:53 [PATCH 0/3] Reshape restart after file system pivot (missing part) Adam Kwolek
2011-10-04 15:53 ` [PATCH 1/3] Always run Grow_continue() for started array Adam Kwolek
2011-10-05  2:59   ` NeilBrown [this message]
2011-10-05  7:04     ` Kwolek, Adam
2011-10-06  4:00       ` NeilBrown
2011-10-04 15:53 ` [PATCH 2/3] Monitor reshaped array Adam Kwolek
2011-10-05  2:59   ` NeilBrown
2011-10-04 15:54 ` [PATCH 3/3] Set correct reshape restart position Adam Kwolek
2011-10-05  3:17   ` 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=20111005135909.13fe29d9@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=marcin.labun@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).