Re: [PATCH 1/6] Limit no-restriping operations only for raid5

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

 



On Wed, 19 Jan 2011 17:23:08 +0100
Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx> wrote:

> If no-restriping needed, we might need to impose some more
> changes: layout, raid_disks, chunk_size but only for raid5 arrays.
> Move this part of code before operations connected with restriping.

I haven't applied this.
It is not clear to me that the code is in the wrong place.
Maybe you introduced some code before this that should have gone after?
or something....

Don't know ...  maybe if you try again it will make more sense next
time.

NeilBrown


> 
> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx>
> ---
>  Grow.c |   81
> ++++++++++++++++++++++++++++++++++------------------------------ 1
> files changed, 43 insertions(+), 38 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index e1ec01c..0ce7c17 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -1656,6 +1656,49 @@ static int reshape_array(char *container, int
> cfd, int fd, char *devname, }
>  	ping_monitor(container);
>  
> +	if (reshape.backup_blocks == 0) {
> +		/* No restriping needed, but we might need to impose
> +		 * some more changes: layout, raid_disks, chunk_size
> +		 */
> +		/* Changes possible only for raid5 arrays */
> +		if (info->array.level != 5) {
> +			unfreeze(st);
> +			return rv;
> +		}
> +		if (info->new_layout != UnSet &&
> +		    info->new_layout != info->array.layout) {
> +			info->array.layout = info->new_layout;
> +			if (ioctl(fd, SET_ARRAY_INFO,
> &info->array) != 0) {
> +				fprintf(stderr, Name ": failed to
> set new layout\n");
> +				rv = 1;
> +			} else if (!quiet)
> +				printf("layout for %s set to %d\n",
> +				       devname, info->array.layout);
> +		}
> +		if (info->delta_disks != UnSet &&
> +		    info->delta_disks != 0) {
> +			info->array.raid_disks += info->delta_disks;
> +			if (ioctl(fd, SET_ARRAY_INFO,
> &info->array) != 0) {
> +				fprintf(stderr, Name ": failed to
> set raid disks\n");
> +				rv = 1;
> +			} else if (!quiet)
> +				printf("raid_disks for %s set to
> %d\n",
> +				       devname,
> info->array.raid_disks);
> +		}
> +		if (info->new_chunk != 0 &&
> +		    info->new_chunk != info->array.chunk_size) {
> +			if (sysfs_set_num(info, NULL,
> +					  "chunk_size",
> info->new_chunk) != 0) {
> +				fprintf(stderr, Name ": failed to
> set chunk size\n");
> +				rv = 1;
> +			} else if (!quiet)
> +				printf("chunk size for %s set to
> %d\n",
> +				       devname,
> info->array.chunk_size);
> +		}
> +		unfreeze(st);
> +		return rv;
> +	}
> +
>  	/* reload metadat as it is possible to change made by monitor
>  	 */
>  	if ((cfd >= 0) &&
> @@ -1718,44 +1761,6 @@ static int reshape_array(char *container, int
> cfd, int fd, char *devname, }
>  	}
>  
> -	if (reshape.backup_blocks == 0) {
> -		/* No restriping needed, but we might need to impose
> -		 * some more changes: layout, raid_disks, chunk_size
> -		 */
> -		if (info->new_layout != UnSet &&
> -		    info->new_layout != info->array.layout) {
> -			info->array.layout = info->new_layout;
> -			if (ioctl(fd, SET_ARRAY_INFO,
> &info->array) != 0) {
> -				fprintf(stderr, Name ": failed to
> set new layout\n");
> -				rv = 1;
> -			} else if (!quiet)
> -				printf("layout for %s set to %d\n",
> -				       devname, info->array.layout);
> -		}
> -		if (info->delta_disks != UnSet &&
> -		    info->delta_disks != 0) {
> -			info->array.raid_disks += info->delta_disks;
> -			if (ioctl(fd, SET_ARRAY_INFO,
> &info->array) != 0) {
> -				fprintf(stderr, Name ": failed to
> set raid disks\n");
> -				rv = 1;
> -			} else if (!quiet)
> -				printf("raid_disks for %s set to
> %d\n",
> -				       devname,
> info->array.raid_disks);
> -		}
> -		if (info->new_chunk != 0 &&
> -		    info->new_chunk != info->array.chunk_size) {
> -			if (sysfs_set_num(info, NULL,
> -					  "chunk_size",
> info->new_chunk) != 0) {
> -				fprintf(stderr, Name ": failed to
> set chunk size\n");
> -				rv = 1;
> -			} else if (!quiet)
> -				printf("chunk size for %s set to
> %d\n",
> -				       devname,
> info->array.chunk_size);
> -		}
> -		unfreeze(st);
> -		return rv;
> -	}
> -
>  	/*
>  	 * There are three possibilities.
>  	 * 1/ The array will shrink.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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