summaryrefslogtreecommitdiff
path: root/sbin/newfs/newfs.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-06-16 00:03:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-06-16 00:03:13 +0000
commitfe86e3771c413df8eecb39530c3a1412236d67e9 (patch)
tree9bbfcbf70cf27cf6fb30f11d6ff6565cb4a88ae6 /sbin/newfs/newfs.c
parentf9f6ddf34b96becf8fe1fd51545d1d05368230ea (diff)
if -o is used to explicitly specify time or space optimization preference,
do not override based on minfree calculation; problem from jgarzik@pobox.com, my fix; PR#226
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r--sbin/newfs/newfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 0523a2f3d7f..783af570292 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.14 1997/02/23 03:51:25 millert Exp $ */
+/* $OpenBSD: newfs.c,v 1.15 1997/06/16 00:03:12 deraadt Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: newfs.c,v 1.14 1997/02/23 03:51:25 millert Exp $";
+static char rcsid[] = "$OpenBSD: newfs.c,v 1.15 1997/06/16 00:03:12 deraadt Exp $";
#endif
#endif /* not lint */
@@ -169,6 +169,7 @@ int cpg = DESCPG; /* cylinders/cylinder group */
int cpgflg; /* cylinders/cylinder group flag was given */
int minfree = MINFREE; /* free space threshold */
int opt = DEFAULTOPT; /* optimization preference (space or time) */
+int reqopt = -1; /* opt preference has not been specified */
int density; /* number of bytes per inode */
int maxcontig = 8; /* max contiguous blocks to allocate */
int rotdelay = ROTDELAY; /* rotational delay between blocks */
@@ -287,9 +288,9 @@ main(argc, argv)
getmntopts(optarg, mopts, &mntflags);
else {
if (strcmp(optarg, "space") == 0)
- opt = FS_OPTSPACE;
+ reqopt = opt = FS_OPTSPACE;
else if (strcmp(optarg, "time") == 0)
- opt = FS_OPTTIME;
+ reqopt = opt = FS_OPTTIME;
else
fatal("%s: unknown optimization preference: use `space' or `time'.");
}
@@ -514,7 +515,7 @@ havelabel:
maxcontig = MAX(1, MIN(MAXPHYS, MAXBSIZE) / bsize - 1);
if (density == 0)
density = NFPI * fsize;
- if (minfree < MINFREE && opt != FS_OPTSPACE) {
+ if (minfree < MINFREE && opt != FS_OPTSPACE && reqopt == -1) {
fprintf(stderr, "Warning: changing optimization to space ");
fprintf(stderr, "because minfree is less than %d%%\n", MINFREE);
opt = FS_OPTSPACE;