summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2001-10-04 12:15:50 +0000
committerroberto <roberto@FreeBSD.org>2001-10-04 12:15:50 +0000
commit7be036f2de07db50603ff3604ec29578cd1abfb9 (patch)
tree899fe6459c1af0fbe5a30bfd219d38a6cbd046ec
parent6c45f70bf25d9a02d94f3962a175b651d055679f (diff)
downloadFreeBSD-src-7be036f2de07db50603ff3604ec29578cd1abfb9.zip
FreeBSD-src-7be036f2de07db50603ff3604ec29578cd1abfb9.tar.gz
Following the discussion in -arch and the submission of a patch by bde, here
it is. I added the manpage change. Submitted by: bde MFC after: 1 week
-rw-r--r--sbin/newfs/newfs.810
-rw-r--r--sbin/newfs/newfs.c21
2 files changed, 20 insertions, 11 deletions
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index 687d22e..b046499 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -112,12 +112,10 @@ for more details on how to set this option.
The block size of the file system, in bytes. It must be a power of 2. The
default size is 8192 bytes, and the smallest allowable size is 4096 bytes.
.It Fl c Ar #cylinders/group
-The number of cylinders per cylinder group in a file system. The default value
-is 22. The maximum value is dependent on a number of other parameters, in
-particular the block size. The best way to find the maximum value for a
-specific file system is to attempt to specify a value which is far too large:
-.Nm
-will print out the maximum value.
+The number of cylinders per cylinder group in a file system. The default
+is to compute the maximum allowed by the other parameters. This value is
+dependent on a number of other parameters, in particular the block size
+and the number of bytes per inode.
.It Fl d Ar rotdelay
This parameter once specified the minimum time in milliseconds required to
initiate another disk transfer on the same cylinder. It was used in determining
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index a133f54..b950f51 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -104,11 +104,10 @@ void fatal();
/*
* 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 22 cylinders
- * per group, which seems to be the largest value allowed given
- * all the other default values.
+ * on a single cylinder. The default is to use as many as possible
+ * cylinders per group.
*/
-#define DESCPG 22 /* desired fs_cpg */
+#define DESCPG 65536 /* desired fs_cpg ("infinity") */
/*
* Once upon a time...
@@ -167,6 +166,7 @@ int Uflag; /* enable soft updates for file system */
int fssize; /* file system size */
int ntracks = NTRACKS; /* # tracks/cylinder */
int nsectors = NSECTORS; /* # sectors/track */
+int ncyls; /* # complete cylinders */
int nphyssectors; /* # sectors/track including spares */
int secpercyl; /* sectors per cylinder */
int trackspares = -1; /* spare sectors per track */
@@ -180,7 +180,7 @@ int headswitch; /* head switch time, usec */
int trackseek; /* track-to-track seek, usec */
int fsize = 0; /* fragment size */
int bsize = 0; /* block size */
-int cpg = DESCPG; /* cylinders/cylinder group */
+int cpg = 0; /* 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) */
@@ -545,6 +545,17 @@ main(argc, argv)
pp->p_size *= secperblk;
}
#endif
+ ncyls = fssize / secpercyl;
+ if (ncyls == 0)
+ ncyls = 1; /* XXX */
+ 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);
#ifdef tahoe
if (realsectorsize != DEV_BSIZE)
OpenPOWER on IntegriCloud