Mod the offset padding by alignment. Without this change we may

pad too much when underlying GEOM object have a zero stripesize.

MFC after:	1 month
This commit is contained in:
Xin LI 2011-06-21 04:46:00 +00:00
parent 621f3e6d9c
commit 4c82b916fc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223356

View File

@ -362,7 +362,7 @@ gpart_autofill_resize(struct gctl_req *req)
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);