FreeBSD Bugzilla – Attachment 173357 Details for
Bug 211361
suggested boot partition size is too small, bsdinstall creates unaligned partitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed fix
file_211361.txt (text/plain), 1.73 KB, created by
Dag-Erling Smørgrav
on 2016-08-06 14:23:31 UTC
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Dag-Erling Smørgrav
Created:
2016-08-06 14:23:31 UTC
Size:
1.73 KB
patch
obsolete
>Index: usr.sbin/bsdinstall/partedit/gpart_ops.c >=================================================================== >--- usr.sbin/bsdinstall/partedit/gpart_ops.c (revision 303770) >+++ usr.sbin/bsdinstall/partedit/gpart_ops.c (working copy) >@@ -795,6 +795,7 @@ > { > struct gconfig *gc; > struct gprovider *pp, **providers; >+ intmax_t sectorsize, stripesize, offset; > intmax_t lastend; > intmax_t start, end; > intmax_t maxsize, maxstart; >@@ -845,12 +846,25 @@ > > pp = LIST_FIRST(&geom->lg_consumer)->lg_provider; > >- /* Compute beginning of new partition and maximum available space */ >- if (pp->lg_stripesize > 0 && >- (maxstart*pp->lg_sectorsize % pp->lg_stripesize) != 0) { >- intmax_t offset = (pp->lg_stripesize - >- ((maxstart*pp->lg_sectorsize) % pp->lg_stripesize)) / >- pp->lg_sectorsize; >+ /* >+ * Round the start and size of the largest available space up to >+ * the nearest multiple of the adjusted stripe size. >+ * >+ * The adjusted stripe size is the least common multiple of the >+ * actual stripe size, or the sector size if no stripe size was >+ * reported, and 4096. The reason for this is that contemporary >+ * disks often have 4096-byte physical sectors but report 512 >+ * bytes instead for compatibility with older / broken operating >+ * systems and BIOSes. For the same reasons, virtualized storage >+ * may also report a 512-byte stripe size, or none at all. >+ */ >+ sectorsize = pp->lg_sectorsize; >+ if ((stripesize = pp->lg_stripesize) == 0) >+ stripesize = sectorsize; >+ while (stripesize % 4096 != 0) >+ stripesize *= 2; >+ if ((offset = maxstart * sectorsize % stripesize) != 0) { >+ offset = (stripesize - offset) / sectorsize; > maxstart += offset; > maxsize -= offset; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211361
: 173357