diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2017-10-06 16:38:00 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2017-10-06 16:38:00 +0000 |
commit | b5dc98c0497f5ae5ee29ccb45383f4c202df8885 (patch) | |
tree | c2b2c3fae2baf935ee249cfc91c5c86069914df9 | |
parent | 845ed71645fcabae1e0b7aee43ac51a80e0d8787 (diff) | |
download | src-b5dc98c0497f5ae5ee29ccb45383f4c202df8885.tar.gz src-b5dc98c0497f5ae5ee29ccb45383f4c202df8885.zip |
Fix alignment of 'last' in autofill.
'last' is the sector number of the last usable sector. Sector
numbers start with 0. As such, 'last' is always 1 less than
the count of sectors and aligning 'last' down as-is means that
the number of free sectors is pessimized by 'alignment - 1' if
the number of usable sectors was already a multiple of the
alignment. Consequently, gpart(8) failed to create a partition
when the alignment and size were such that it would extend to
the end of the disk.
Notes
Notes:
svn path=/head/; revision=324369
-rw-r--r-- | sbin/geom/class/part/geom_part.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c index d21e5eb6b657..7f668d32e9a6 100644 --- a/sbin/geom/class/part/geom_part.c +++ b/sbin/geom/class/part/geom_part.c @@ -547,7 +547,7 @@ gpart_autofill(struct gctl_req *req) last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); - last = ALIGNDOWN(last + offset, alignment); + last = ALIGNDOWN(last + offset + 1, alignment) - 1; if (a_first < start) a_first = start; while ((pp = find_provider(gp, first)) != NULL) { |