summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/setup.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2011-04-16 16:37:21 +0000
committerotto <otto@openbsd.org>2011-04-16 16:37:21 +0000
commit4d91232b4eb954dee8b64f6b5c7f11a85bdeed6a (patch)
tree785734aeda881d5c918bd4e096db95fb1c92ee44 /sbin/fsck_ffs/setup.c
parentjmc@ is merciless. But fair. (diff)
downloadwireguard-openbsd-4d91232b4eb954dee8b64f6b5c7f11a85bdeed6a.tar.xz
wireguard-openbsd-4d91232b4eb954dee8b64f6b5c7f11a85bdeed6a.zip
Blend in some code from netbsd and freebsd that reduces memory consumption
and speeds things up in a lot of cases. Prompted by Amit Kulkarni; ok krw@ on a slighly diffrenent incarnation
Diffstat (limited to 'sbin/fsck_ffs/setup.c')
-rw-r--r--sbin/fsck_ffs/setup.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 590c3ea105a..1bcd85aa62a 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.46 2010/08/12 15:26:34 jsing Exp $ */
+/* $OpenBSD: setup.c,v 1.47 2011/04/16 16:37:21 otto Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -427,22 +427,11 @@ found:
(unsigned)bmapsize);
goto badsblabel;
}
- stmap = calloc((unsigned)(maxino + 1), sizeof(char));
- if (stmap == NULL) {
- printf("cannot alloc %u bytes for stmap\n",
- (unsigned)(maxino + 1));
- goto badsblabel;
- }
- lncntp = calloc((unsigned)(maxino + 1), sizeof(int16_t));
- if (lncntp == NULL) {
- printf("cannot alloc %zu bytes for lncntp\n",
- (maxino + 1) * sizeof(int16_t));
- goto badsblabel;
- }
- cginosused = calloc((unsigned)sblock.fs_ncg, sizeof(long));
- if (cginosused == NULL) {
- printf("cannot alloc %u bytes for cginosused\n",
- (unsigned)sblock.fs_ncg);
+ inostathead = calloc((unsigned)(sblock.fs_ncg),
+ sizeof(struct inostatlist));
+ if (inostathead == NULL) {
+ printf("cannot alloc %u bytes for inostathead\n",
+ (unsigned)(sizeof(struct inostatlist) * (sblock.fs_ncg)));
goto badsblabel;
}
numdirs = MAX(sblock.fs_cstotal.cs_ndir, 128);