summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs/newfs.86
-rw-r--r--sbin/newfs/newfs.c11
2 files changed, 9 insertions, 8 deletions
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index 2358fd28dc6..a2ce2d6fb5c 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: newfs.8,v 1.5 1997/02/23 03:51:24 millert Exp $
+.\" $OpenBSD: newfs.8,v 1.6 1997/06/16 00:03:10 deraadt Exp $
.\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993, 1994
@@ -192,8 +192,8 @@ The number of distinct rotational positions. The default is 1.
.Pq ``space'' or ``time''
The file system can either be instructed to try to minimize the time spent
allocating blocks, or to try to minimize the space fragmentation on the disk.
-If the value of minfree (see above) is less than 5%,
-the default is to optimize for space;
+Unless an optimizations has been specified, if the value of minfree
+(see above) is less than 5%, the default is to optimize for space;
if the value of minfree is greater than or equal to 5%,
the default is to optimize for time.
See
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;