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 4/8] Set correct reshape restart position
Date: Mon, 3 Oct 2011 09:56:49 +1100	[thread overview]
Message-ID: <20111003095649.0d033943@notabene.brown> (raw)
In-Reply-To: <20110927120505.4890.95696.stgit@gklab-128-013.igk.intel.com>

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

On Tue, 27 Sep 2011 14:05:05 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:

> During initrd stage when, when array is assembled with '--freeze-reshape'
> option and before stopping reshape, reshape position has to be set to read
> from metadata checkpoint.
> This will allow later for restart point verification and user will be able
> to see in mdstat information about reshape process instead resync when
> reshape position is set to 0.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>

Hi,
 I think that this patch makes start_reshape rather messy and confusing.
I am tempted to say not do do this at all, and maybe fix the kernel so that
is reports better information.

However it might be reasonable to do something like this in mdadm.  If so
I would like it to go in the  "if (freeze_reshape)" branch in
reshape_array(), and just explicitly set "sync_max".  There should be no need
to set sync_min - is there?

Thanks,
NeilBrown


> ---
> 
>  Grow.c |   26 +++++++++++++++-----------
>  1 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index d9c2817..afe4c72 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -696,21 +696,24 @@ static int subarray_set_num(char *container, struct mdinfo *sra, char *name, int
>  	return rc;
>  }
>  
> -int start_reshape(struct mdinfo *sra, int already_running, int freeze_reshape)
> +int start_reshape(struct mdinfo *sra, int already_running,
> +		  int freeze_reshape, int data_disks)
>  {
>  	int err;
> +	unsigned long long position_to_set = 0;
> +	unsigned long long sync_max_to_set;
>  
>  	/* do not block array as we not continue reshape this time
>  	 */
> -	if (freeze_reshape == FREEZE_RESHAPE_NONE)
> -		sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
> -	else
> -		sysfs_set_num(sra, NULL, "suspend_lo", 0);
> -	err = sysfs_set_num(sra, NULL, "suspend_hi", 0);
> -	err = err ?: sysfs_set_num(sra, NULL, "suspend_lo", 0);
> +	if (freeze_reshape != FREEZE_RESHAPE_NONE)
> +		position_to_set = sra->reshape_progress;
> +	sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
> +	err = sysfs_set_num(sra, NULL, "suspend_hi", position_to_set);
> +	err = err ?: sysfs_set_num(sra, NULL, "suspend_lo", position_to_set);
> +	sync_max_to_set = position_to_set / data_disks;
>  	if (!already_running)
> -		sysfs_set_num(sra, NULL, "sync_min", 0);
> -	err = err ?: sysfs_set_num(sra, NULL, "sync_max", 0);
> +		sysfs_set_num(sra, NULL, "sync_min", sync_max_to_set);
> +	err = err ?: sysfs_set_num(sra, NULL, "sync_max", sync_max_to_set);
>  	if (!already_running)
>  		err = err ?: sysfs_set_str(sra, NULL, "sync_action", "reshape");
>  
> @@ -2247,7 +2250,8 @@ started:
>  		}
>  	}
>  
> -	err = start_reshape(sra, restart, freeze_reshape);
> +	err = start_reshape(sra, restart, freeze_reshape,
> +			   info->array.raid_disks - reshape.parity);
>  	if (err) {
>  		fprintf(stderr, 
>  			Name ": Cannot %s reshape for %s\n",
> @@ -3753,7 +3757,7 @@ int Grow_continue_command(char *devname, int fd,
>  	/* continue reshape
>  	 */
>  	ret_val = Grow_continue(fd, st, content, backup_file,
> -				FREEZE_RESHAPE_NONE);
> +				FREEZE_RESHAPE_CONTINUE);
>  
>  Grow_continue_command_exit:
>  	if (fd2 > -1)


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

  reply	other threads:[~2011-10-02 22:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 12:04 [PATCH 0/8] Reshape restart after filesystem pivot Adam Kwolek
2011-09-27 12:04 ` [PATCH 1/8] Do not continue reshape during initrd phase Adam Kwolek
2011-10-02 22:19   ` NeilBrown
2011-09-27 12:04 ` [PATCH 2/8] Add continue option to grow command Adam Kwolek
2011-10-02 22:27   ` NeilBrown
2011-09-27 12:04 ` [PATCH 3/8] Do not restart reshape if it is started already Adam Kwolek
2011-10-02 22:41   ` NeilBrown
2011-09-27 12:05 ` [PATCH 4/8] Set correct reshape restart position Adam Kwolek
2011-10-02 22:56   ` NeilBrown [this message]
2011-09-27 12:05 ` [PATCH 5/8] Move code to get_data_disks() function Adam Kwolek
2011-10-02 22:58   ` NeilBrown
2011-09-27 12:05 ` [PATCH 6/8] Verify reshape restart position Adam Kwolek
2011-10-02 23:06   ` NeilBrown
2011-09-27 12:05 ` [PATCH 7/8] Manual update for --continue option Adam Kwolek
2011-09-27 12:05 ` [PATCH 8/8] " Adam Kwolek
2011-10-02 23:09   ` 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=20111003095649.0d033943@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).