Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst PR 55991: when extending the marked partiti...
details: https://anonhg.NetBSD.org/src/rev/c4a2afd2b694
branches: trunk
changeset: 952351:c4a2afd2b694
user: martin <martin%NetBSD.org@localhost>
date: Sat Feb 13 15:31:35 2021 +0000
description:
PR 55991: when extending the marked partition (typically: the NetBSD root
partition) round the new size up to current alignment.
This may lead to a slightly smaller than initialy planned last partition
(depending on order added) if the disk size is odd or the partitioning
scheme needs some internal space (like GPT) - but it avoids gaps elsewhere
due to alignement.
Ideally we would pin all other partitions in a first pass and then let
the partitioning backend pick the full available size for the extended
partition, but this should be good enough.
diffstat:
usr.sbin/sysinst/bsddisklabel.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diffs (45 lines):
diff -r bee4c8a8d356 -r c4a2afd2b694 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c Sat Feb 13 14:30:37 2021 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c Sat Feb 13 15:31:35 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bsddisklabel.c,v 1.57 2021/01/31 22:45:46 rillig Exp $ */
+/* $NetBSD: bsddisklabel.c,v 1.58 2021/02/13 15:31:35 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1387,6 +1387,8 @@
* Pass one: calculate space available for expanding
* the marked partition.
*/
+ if (parts->free_space != parts->disk_size)
+ planned_space = align; /* align first part */
for (i = 0; i < wanted->num; i++) {
if ((wanted->infos[i].flags & PUIFLAG_EXTEND) &&
exp_ndx == ~0U)
@@ -1403,8 +1405,9 @@
if (!(wanted->infos[i].flags & PUIFLG_IS_OUTER))
nsp -= infos[i].size;
}
- if (nsp > 0)
- planned_space += roundup(nsp, align);
+ if (nsp <= 0)
+ continue;
+ planned_space += roundup(nsp, align);
}
/*
@@ -1412,12 +1415,10 @@
* but check size limits.
*/
if (exp_ndx < wanted->num) {
- daddr_t free_space =
- parts->free_space - roundup(wanted->reserved_space, align);
- free_space -= planned_space;
+ daddr_t free_space = parts->free_space - planned_space;
daddr_t new_size = wanted->infos[exp_ndx].size;
if (free_space > 0)
- new_size += free_space;
+ new_size += roundup(free_space,align);
if (wanted->infos[exp_ndx].limit > 0 &&
(new_size + wanted->infos[exp_ndx].cur_start)
Home |
Main Index |
Thread Index |
Old Index