Author: ae
Date: Tue Jun  7 11:11:11 2011
New Revision: 222819
URL: http://svn.freebsd.org/changeset/base/222819

Log:
  Do not use LCM from stripesize and user specified alignment value.
  When user wants have specific alignment - do what user wants.
  Use stripesize as alignment value in case, when some of gpart's
  arguments are ommitted for automatic calculation.
  
  Suggested by: mav

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  7 09:37:08 2011        
(r222818)
+++ head/sbin/geom/class/part/geom_part.c       Tue Jun  7 11:11:11 2011        
(r222819)
@@ -341,9 +341,10 @@ gpart_autofill_resize(struct gctl_req *r
                        errc(EXIT_FAILURE, error, "Invalid alignment param");
                if (alignment == 0)
                        errx(EXIT_FAILURE, "Invalid alignment param");
+       } else {
                lba = pp->lg_stripesize / pp->lg_sectorsize;
                if (lba > 0)
-                       alignment = g_lcm(lba, alignment);
+                       alignment = lba;
        }
        error = gctl_delete_param(req, "alignment");
        if (error)
@@ -491,13 +492,9 @@ gpart_autofill(struct gctl_req *req)
        if (has_size && has_start && !has_alignment)
                goto done;
 
-       /*
-        * If stripesize is not zero, then recalculate alignment value.
-        * Use LCM from stripesize and user specified alignment.
-        */
        len = pp->lg_stripesize / pp->lg_sectorsize;
-       if (len > 0 )
-               alignment = g_lcm(len, alignment);
+       if (len > 0 && !has_alignment)
+               alignment = len;
 
        /* Adjust parameters to stripeoffset */
        offset = pp->lg_stripeoffset / pp->lg_sectorsize;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to