On 21.06.2011 8:46, Xin LI wrote:
> Author: delphij
> Date: Tue Jun 21 04:46:00 2011
> New Revision: 223356
> URL: http://svn.freebsd.org/changeset/base/223356
> 
> Log:
>   Mod the offset padding by alignment.  Without this change we may
>   pad too much when underlying GEOM object have a zero stripesize.

No. In any way offset value could not be greater than mediasize.
And it do nothing when alignment value is 1.

>   MFC after:  1 month

I did not MFC'd these changes yet.

> Modified:
>   head/sbin/geom/class/part/geom_part.c
> 
> Modified: head/sbin/geom/class/part/geom_part.c
> ==============================================================================
> --- head/sbin/geom/class/part/geom_part.c     Tue Jun 21 04:06:39 2011        
> (r223355)
> +++ head/sbin/geom/class/part/geom_part.c     Tue Jun 21 04:46:00 2011        
> (r223356)
> @@ -362,7 +362,7 @@ gpart_autofill_resize(struct gctl_req *r
>                       goto done;
>       }
>  
> -     offset = pp->lg_stripeoffset / pp->lg_sectorsize;
> +     offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment;
>       last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0);
>       LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
>               s = find_provcfg(pp, "index");
> @@ -497,7 +497,7 @@ gpart_autofill(struct gctl_req *req)
>               alignment = len;
>  
>       /* Adjust parameters to stripeoffset */
> -     offset = pp->lg_stripeoffset / pp->lg_sectorsize;
> +     offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment;
>       start = ALIGNUP(start + offset, alignment);
>       if (size > alignment)
>               size = ALIGNDOWN(size, alignment);
> 
> 


-- 
WBR, Andrey V. Elsukov

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to