All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mdadm] ddf: use 64bit 'size', not 32bit 'info->size' for create.
@ 2016-03-10  7:06 NeilBrown
  2016-03-10 16:43 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: NeilBrown @ 2016-03-10  7:06 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: Dan Russell, linux-raid

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


The 'size' field of mdu_disk_info_t is 32bit and should not be used
except for legacy ioctls.  super-ddf got this wrong :-(

This change makes it possible to create ddf arrays which used more than
2TB of each device.

Reported-by: Dan Russell <dpr@aol.com>
Signed-off-by: NeilBrown <neilb@suse.com>
---
 super-ddf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/super-ddf.c b/super-ddf.c
index faaf0a7ca9e0..0e00d17dd169 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2688,10 +2688,10 @@ static int init_super_ddf_bvd(struct supertype *st,
 		free(vcl);
 		return 0;
 	}
-	vc->blocks = cpu_to_be64(info->size * 2);
+	vc->blocks = cpu_to_be64(size * 2);
 	vc->array_blocks = cpu_to_be64(
 		calc_array_size(info->level, info->raid_disks, info->layout,
-				info->chunk_size, info->size*2));
+				info->chunk_size, size*2));
 	memset(vc->pad1, 0xff, 8);
 	vc->spare_refs[0] = cpu_to_be32(0xffffffff);
 	vc->spare_refs[1] = cpu_to_be32(0xffffffff);
-- 
2.7.2


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH mdadm] ddf: use 64bit 'size', not 32bit 'info->size' for create.
  2016-03-10  7:06 [PATCH mdadm] ddf: use 64bit 'size', not 32bit 'info->size' for create NeilBrown
@ 2016-03-10 16:43 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2016-03-10 16:43 UTC (permalink / raw)
  To: NeilBrown; +Cc: Dan Russell, linux-raid

NeilBrown <neilb@suse.com> writes:
> The 'size' field of mdu_disk_info_t is 32bit and should not be used
> except for legacy ioctls.  super-ddf got this wrong :-(
>
> This change makes it possible to create ddf arrays which used more than
> 2TB of each device.
>
> Reported-by: Dan Russell <dpr@aol.com>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  super-ddf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/super-ddf.c b/super-ddf.c
> index faaf0a7ca9e0..0e00d17dd169 100644
> --- a/super-ddf.c
> +++ b/super-ddf.c
> @@ -2688,10 +2688,10 @@ static int init_super_ddf_bvd(struct supertype *st,
>  		free(vcl);
>  		return 0;
>  	}
> -	vc->blocks = cpu_to_be64(info->size * 2);
> +	vc->blocks = cpu_to_be64(size * 2);
>  	vc->array_blocks = cpu_to_be64(
>  		calc_array_size(info->level, info->raid_disks, info->layout,
> -				info->chunk_size, info->size*2));
> +				info->chunk_size, size*2));
>  	memset(vc->pad1, 0xff, 8);
>  	vc->spare_refs[0] = cpu_to_be32(0xffffffff);
>  	vc->spare_refs[1] = cpu_to_be32(0xffffffff);

Thanks for the fix! I applied it with a small mod, adding the missing
spaces in the last line:

> +				info->chunk_size, size * 2));

Cheers,
Jes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-10 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10  7:06 [PATCH mdadm] ddf: use 64bit 'size', not 32bit 'info->size' for create NeilBrown
2016-03-10 16:43 ` Jes Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.