diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-07-16 18:02:37 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-07-16 18:02:37 +0000 |
commit | d7a2a4d548d3f3ab6e52e6a605c58d9f5ecbf3aa (patch) | |
tree | 53989c3458d91cf036db51de74f5eca3fee9d3a5 /sbin/newfs | |
parent | f58738aceeb6ea2e2a00fa3c259f7fd8ada1fb49 (diff) |
remove default limit of 16 cylinders per group. it's now set to
as many as fit with the other parameters given.
change default frag size to 2048, bumping block size to 16k.
from freebsd.
ok deraadt@ and co.
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/mkfs.c | 10 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 28 |
2 files changed, 23 insertions, 15 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 91680d704fc..82c37c5bfb3 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.31 2003/07/02 21:44:58 deraadt Exp $ */ +/* $OpenBSD: mkfs.c,v 1.32 2003/07/16 18:02:35 tedu Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94"; #else -static char rcsid[] = "$OpenBSD: mkfs.c,v 1.31 2003/07/02 21:44:58 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mkfs.c,v 1.32 2003/07/16 18:02:35 tedu Exp $"; #endif #endif /* not lint */ @@ -432,10 +432,8 @@ recalc: printf("cylinder groups must have at least %ld cylinders\n", mincpg); exit(25); - } else if (sblock.fs_cpg != cpg) { - if (!cpgflg) - printf("Warning: "); - else if (!mapcramped && !inodecramped) + } else if (cpgflg && sblock.fs_cpg != cpg) { + if (!mapcramped && !inodecramped) exit(26); if (mapcramped && inodecramped) printf("Block size and bytes per inode restrict"); diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 3694c823e72..f1ae1e7065b 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.43 2003/07/02 21:44:58 deraadt Exp $ */ +/* $OpenBSD: newfs.c,v 1.44 2003/07/16 18:02:36 tedu Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -40,7 +40,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.43 2003/07/02 21:44:58 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: newfs.c,v 1.44 2003/07/16 18:02:36 tedu Exp $"; #endif #endif /* not lint */ @@ -98,16 +98,16 @@ u_short dkcksum(struct disklabel *); * sectorsize <= DESFRAGSIZE <= DESBLKSIZE * DESBLKSIZE / DESFRAGSIZE <= 8 */ -#define DFL_FRAGSIZE 1024 -#define DFL_BLKSIZE 8192 +#define DFL_FRAGSIZE 2048 +#define DFL_BLKSIZE 16384 /* * Cylinder groups may have up to many cylinders. The actual * number used depends upon how much information can be stored - * on a single cylinder. The default is to use 16 cylinders - * per group. + * on a single cylinder. The default is to use as many as + * possible. */ -#define DESCPG 16 /* desired fs_cpg */ +#define DESCPG 65536 /* desired fs_cpg */ /* * ROTDELAY gives the minimum number of milliseconds to initiate @@ -160,7 +160,7 @@ int interleave; /* hardware sector interleave */ int trackskew = -1; /* sector 0 skew, per track */ int fsize = 0; /* fragment size */ int bsize = 0; /* block size */ -int cpg = DESCPG; /* cylinders/cylinder group */ +int cpg; /* 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) */ @@ -199,7 +199,7 @@ main(int argc, char *argv[]) struct stat st; struct statfs *mp; struct rlimit rl; - int fsi = -1, fso, len, n, maxpartitions; + int fsi = -1, fso, len, n, ncyls, maxpartitions; char *cp, *s1, *s2, *special, *opstring; #ifdef MFS char mountfromname[BUFSIZ]; @@ -586,6 +586,16 @@ havelabel: fssize *= blkpersec; pp->p_size *= blkpersec; } + ncyls = fssize / secpercyl; + if (ncyls == 0) + ncyls = 1; + if (cpg == 0) + cpg = DESCPG < ncyls ? DESCPG : ncyls; + else if (cpg > ncyls) { + cpg = ncyls; + printf("Number of cylinders restricts cylinders per group " + "to %d.\n", cpg); + } mkfs(pp, special, fsi, fso); if (realsectorsize < DEV_BSIZE) pp->p_size *= DEV_BSIZE / realsectorsize; |