Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Sep 2001 05:58:53 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Kirk McKusick <mckusick@mckusick.com>
Cc:        Ollivier Robert <roberto@eurocontrol.fr>, <freebsd-arch@FreeBSD.ORG>, <obrien@FreeBSD.ORG>
Subject:   Re: New option for newfs 
Message-ID:  <20010921054417.Q70596-100000@delplex.bde.org>
In-Reply-To: <200109201815.f8KIFQh33875@beastie.mckusick.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 20 Sep 2001, Kirk McKusick wrote:

> > From: "David O'Brien" <obrien@FreeBSD.ORG>
> > ...
> > On Thu, Sep 20, 2001 at 06:14:23PM +0200, Ollivier Robert wrote:
> > > Proposal: a new option ('-M') that says: ignore -c if present, calculate
> > > the maxcpg allowed for the given argument to newfs and use that.
> >
> > I like the general idea, but not adding another option (especially one
> > that says to ignore another one).  What about chaning -c to accept 0 or
> > -1 and to use the largest maxcpg value possible.
>
> I like the idea, but also do not like the implementation.
> I would propose an even simpler change. If -c is not specified,
> have it select the maximum possible rather than the current
> default value of 22. Users that do not want the maximum possible
> can over-ride that default by using -c.

I have used this change for almost a year.

IIRC, just changing DESCPG to a huge value is sufficient (newfs reduces
from the default to the maximum if the default is larger).  The ncyls
stuff is to fix (?) the cosmetic (?) problem that bogus warnings are
printed for vary small disks (ones where there are more cpg's than
cylinders).

The patch is missing the manpage changes.

%%%
Index: newfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/newfs/newfs.c,v
retrieving revision 1.40
diff -u -2 -r1.40 newfs.c
--- newfs.c	19 Aug 2001 08:19:37 -0000	1.40
+++ newfs.c	20 Sep 2001 18:55:28 -0000
@@ -105,9 +97,8 @@
  * 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") */

 /*
@@ -168,4 +159,5 @@
 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 */
@@ -181,5 +173,5 @@
 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 */
@@ -546,4 +538,15 @@
 	}
 #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
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010921054417.Q70596-100000>