[sheepdog] [PATCH v2] collie: don't roundup vdi size

MORITA Kazutaka morita.kazutaka at gmail.com
Tue May 21 14:26:21 CEST 2013


At Tue, 21 May 2013 19:54:35 +0800,
Liu Yuan wrote:
> 
> Glance doesn't assume the size will be rounded up. We don't need block uint
> constraint, it is no harm to support random read/write on the sheepdog vdi
> on the byte granularity.

s/Glance/OpenStack Glance/

Otherwise, anyone who is not familiar with OpenStack doesn't
understand what Glance is.


> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  collie/vdi.c |   12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/collie/vdi.c b/collie/vdi.c
> index 27a8418..9dd2251 100644
> --- a/collie/vdi.c
> +++ b/collie/vdi.c
> @@ -523,7 +523,7 @@ static int do_vdi_create(const char *vdiname, int64_t vdi_size,
>  
>  	hdr.vdi.base_vdi_id = base_vid;
>  	hdr.vdi.snapid = snapshot ? 1 : 0;
> -	hdr.vdi.vdi_size = roundup(vdi_size, 512);
> +	hdr.vdi.vdi_size = vdi_size;
>  	hdr.vdi.copies = nr_copies;
>  
>  	ret = collie_exec_req(sdhost, sdport, &hdr, buf);
> @@ -1187,10 +1187,6 @@ static int vdi_read(int argc, char **argv)
>  		ret = parse_option_size(argv[optind++], &offset);
>  		if (ret < 0)
>  			return EXIT_USAGE;
> -		if (offset % 512 != 0) {
> -			fprintf(stderr, "Read offset must be block-aligned\n");
> -			return EXIT_USAGE;
> -		}
>  		if (argv[optind]) {
>  			ret = parse_option_size(argv[optind++], &total);
>  			if (ret < 0)
> @@ -1214,7 +1210,6 @@ static int vdi_read(int argc, char **argv)
>  	}
>  
>  	total = min(total, inode->vdi_size - offset);
> -	total = roundup(total, 512);
>  	idx = offset / SD_DATA_OBJ_SIZE;
>  	offset %= SD_DATA_OBJ_SIZE;
>  	while (done < total) {
> @@ -1270,10 +1265,6 @@ static int vdi_write(int argc, char **argv)
>  		ret = parse_option_size(argv[optind++], &offset);
>  		if (ret < 0)
>  			return EXIT_USAGE;
> -		if (offset % 512 != 0) {
> -			fprintf(stderr, "Write offset must be block-aligned\n");
> -			return EXIT_USAGE;
> -		}
>  		if (argv[optind]) {
>  			ret = parse_option_size(argv[optind++], &total);
>  			if (ret < 0)
> @@ -1295,7 +1286,6 @@ static int vdi_write(int argc, char **argv)
>  	}
>  
>  	total = min(total, inode->vdi_size - offset);
> -	total = roundup(total, 512);
>  	idx = offset / SD_DATA_OBJ_SIZE;
>  	offset %= SD_DATA_OBJ_SIZE;
>  	while (done < total) {

Nack, the data length must be sector aligned when we use direct I/O.
Can't we modify Glance sheepdog driver so that we don't need these
changes?

Thanks,

Kazutaka



More information about the sheepdog mailing list