Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Redo the root-size-limit check again after ...



details:   https://anonhg.NetBSD.org/src/rev/4fb1310f0961
branches:  trunk
changeset: 932566:4fb1310f0961
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 11 15:27:41 2020 +0000

description:
Redo the root-size-limit check again after we grew the root partition
for kernel dumps. Auto-enable the /usr partition if it overflows.
For all non-root partitions, default to FFSv2.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |  35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r 3aa2ea83dcea -r 4fb1310f0961 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Mon May 11 15:15:15 2020 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Mon May 11 15:27:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.39 2020/02/06 20:17:04 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.40 2020/05/11 15:27:41 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -143,8 +143,10 @@
        { .type = PT_root, .mount = "/tmp", .fs_type = FS_MFS,
          .flags = PUIFLG_JUST_MOUNTPOINT },
 #endif
-       { .def_size = DEFUSRSIZE*(MEG/512), .mount = "/usr", .type = PT_root },
-       { .def_size = DEFVARSIZE*(MEG/512), .mount = "/var", .type = PT_root },
+       { .def_size = DEFUSRSIZE*(MEG/512), .mount = "/usr", .type = PT_root,
+         .fs_type = FS_BSDFFS, .fs_version = 2 },
+       { .def_size = DEFVARSIZE*(MEG/512), .mount = "/var", .type = PT_root,
+         .fs_type = FS_BSDFFS, .fs_version = 2 },
 };
 
 static const char size_separator[] =
@@ -1100,7 +1102,7 @@
        if (usr < wanted->num)
                required += wanted->infos[usr].size;
        else if (def_usr < wanted->num)
-                       required += wanted->infos[def_usr].def_size;
+               required += wanted->infos[def_usr].def_size;
        free_space -= required;
        for (i = 0; i < wanted->num; i++) {
                if (i == root || i == usr)
@@ -1132,6 +1134,31 @@
                if (free_space > dump_space)
                        wanted->infos[root].size += dump_space;
        }
+       if (wanted->infos[root].limit > 0 &&
+           wanted->infos[root].size > wanted->infos[root].limit) {
+               if (usr >= wanted->num && def_usr < wanted->num) {
+                       usr = def_usr;
+                       wanted->infos[usr].size = wanted->infos[root].size
+                           - wanted->infos[root].limit;
+                       wanted->infos[root].size =
+                           wanted->infos[root].limit;
+                       if (wanted->infos[root].flags & PUIFLAG_EXTEND) {
+                               wanted->infos[root].flags &= ~PUIFLAG_EXTEND;
+                               wanted->infos[usr].flags |= PUIFLAG_EXTEND;
+                       }
+               } else if (usr < wanted->num) {
+                       /* move space from root to usr */
+                       daddr_t spill = wanted->infos[root].size -
+                           wanted->infos[root].limit;
+                       spill = roundup(spill, align);
+                       wanted->infos[root].size =
+                           wanted->infos[root].limit;
+                       wanted->infos[usr].size = spill;
+               } else {
+                       wanted->infos[root].size =
+                           wanted->infos[root].limit;
+               }
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index