Re: [PATCH 4/8] Set correct reshape restart position

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 27 Sep 2011 14:05:05 +0200 Adam Kwolek <adam.kwolek@xxxxxxxxx> 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@xxxxxxxxx>

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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux