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
This commit is contained in:
Ollivier Robert 2001-10-04 12:15:50 +00:00
parent 3d8712c3a1
commit 08870345f5
2 changed files with 20 additions and 11 deletions

View File

@ -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 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. default size is 8192 bytes, and the smallest allowable size is 4096 bytes.
.It Fl c Ar #cylinders/group .It Fl c Ar #cylinders/group
The number of cylinders per cylinder group in a file system. The default value The number of cylinders per cylinder group in a file system. The default
is 22. The maximum value is dependent on a number of other parameters, in is to compute the maximum allowed by the other parameters. This value is
particular the block size. The best way to find the maximum value for a dependent on a number of other parameters, in particular the block size
specific file system is to attempt to specify a value which is far too large: and the number of bytes per inode.
.Nm
will print out the maximum value.
.It Fl d Ar rotdelay .It Fl d Ar rotdelay
This parameter once specified the minimum time in milliseconds required to This parameter once specified the minimum time in milliseconds required to
initiate another disk transfer on the same cylinder. It was used in determining initiate another disk transfer on the same cylinder. It was used in determining

View File

@ -104,11 +104,10 @@ void fatal();
/* /*
* Cylinder groups may have up to many cylinders. The actual * Cylinder groups may have up to many cylinders. The actual
* number used depends upon how much information can be stored * number used depends upon how much information can be stored
* on a single cylinder. The default is to use 22 cylinders * on a single cylinder. The default is to use as many as possible
* per group, which seems to be the largest value allowed given * cylinders per group.
* all the other default values.
*/ */
#define DESCPG 22 /* desired fs_cpg */ #define DESCPG 65536 /* desired fs_cpg ("infinity") */
/* /*
* Once upon a time... * Once upon a time...
@ -167,6 +166,7 @@ int Uflag; /* enable soft updates for file system */
int fssize; /* file system size */ int fssize; /* file system size */
int ntracks = NTRACKS; /* # tracks/cylinder */ int ntracks = NTRACKS; /* # tracks/cylinder */
int nsectors = NSECTORS; /* # sectors/track */ int nsectors = NSECTORS; /* # sectors/track */
int ncyls; /* # complete cylinders */
int nphyssectors; /* # sectors/track including spares */ int nphyssectors; /* # sectors/track including spares */
int secpercyl; /* sectors per cylinder */ int secpercyl; /* sectors per cylinder */
int trackspares = -1; /* spare sectors per track */ 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 trackseek; /* track-to-track seek, usec */
int fsize = 0; /* fragment size */ int fsize = 0; /* fragment size */
int bsize = 0; /* block 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 cpgflg; /* cylinders/cylinder group flag was given */
int minfree = MINFREE; /* free space threshold */ int minfree = MINFREE; /* free space threshold */
int opt = DEFAULTOPT; /* optimization preference (space or time) */ int opt = DEFAULTOPT; /* optimization preference (space or time) */
@ -545,6 +545,17 @@ main(argc, argv)
pp->p_size *= secperblk; pp->p_size *= secperblk;
} }
#endif #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); mkfs(pp, special, fsi, fso);
#ifdef tahoe #ifdef tahoe
if (realsectorsize != DEV_BSIZE) if (realsectorsize != DEV_BSIZE)