From owner-freebsd-arch Sun Oct 28 16:36:11 2001 Delivered-To: freebsd-arch@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 1BE4137B401; Sun, 28 Oct 2001 16:35:54 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id IAA03251; Mon, 29 Oct 2001 08:14:09 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01KA2EIUINDS2FELOH@cim.alcatel.com.au>; Mon, 29 Oct 2001 08:14:01 +1000 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.1/8.11.1) id f9SLE1F91464; Mon, 29 Oct 2001 08:14:01 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Mon, 29 Oct 2001 08:14:01 +1100 From: Peter Jeremy Subject: Re: cvs commit: src/sbin/newfs newfs.8 newfs.c In-reply-to: <200110261630.f9QGTwa79290@aldan.algebra.com>; from mi@aldan.algebra.com on Fri, Oct 26, 2001 at 12:29:55PM -0400 To: Mikhail Teterin Cc: obrien@FreeBSD.org, cvs-committers@FreeBSD.org, freebsd-arch@FreeBSD.org Mail-Followup-To: Mikhail Teterin , obrien@FreeBSD.org, cvs-committers@FreeBSD.org, freebsd-arch@FreeBSD.org Message-id: <20011029081400.H75481@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <20011026153413.Z75481@gsmx07.alcatel.com.au> <200110261630.f9QGTwa79290@aldan.algebra.com> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2001-Oct-26 12:29:55 -0400, Mikhail Teterin wrote: >On 26 Oct, Peter Jeremy wrote: >> On Sun, Oct 14, 2001 at 07:42:32PM -0700, David O'Brien wrote: >>>"-c" was a no-brainer as noone has ever argued that a low "-c" was >>>prefered (that I've seen). >> >> I can think of one case: For small filesystems, I often reduce "-c" to >> ensure that there are at least 2 cylinder groups (in case one >> superblock gets corrupted). Where there are only 2-3 CG's, I might >> juggle "-c" and the slice size to make the last CG the same size as >> the other CGs. > >Why don't we make newfs apply this (and/or similar) heuristics by >default -- when no options are specified? The following patch will make newfs default to 2 cylinder groups where a filesystem has 4 or more cylinders. (You probably don't want more than 1 CG on smaller filesystems). If this results in excessively large CPs, it will be reduced in mkfs(). For filesystems just over twice the maximum size of a cylinder group, having cpg = ncyls/3 would give a more even spread, but would require a more extensive change in mkfs(). It's obviously impractical for newfs to tweak the partition size to suit itself. Note: This patch is untested. It should apply to -stable as well, but the line numbers for the 2nd hunk are too far out for patch(1) to handle ("@@ -618,8 +622,14 @@" is the appropriate hunk header for -stable). When manually applied to -stable, newfs compiles. (My running -current is too out-of date to easily compile it). Index: newfs.c =================================================================== RCS file: /home/CVSROOT/src/sbin/newfs/newfs.c,v retrieving revision 1.42 diff -u -r1.42 newfs.c --- newfs.c 2001/10/04 12:24:18 1.42 +++ newfs.c 2001/10/28 20:52:29 @@ -102,12 +102,16 @@ #define DFL_BLKSIZE 8192 /* - * 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 as many as possible - * cylinders per group. + * Cylinder groups comprise an integral number of cylinders. The + * actual number used depends upon how much information can be stored + * on a single cylinder. The default is to have a single group for + * filesystems smaller than TINYFS cylinders and MINCGS cylinder + * groups otherwise. The actual number of cylinder groups may be + * larger than MINCGS due to restrictions on the number of cylinders + * per group. */ -#define DESCPG 65536 /* desired fs_cpg ("infinity") */ +#define TINYFS 4 /* Default to 1 CG below this size */ +#define MINCGS 2 /* Default to this many cylinder groups */ /* * Once upon a time... @@ -548,8 +552,14 @@ ncyls = fssize / secpercyl; if (ncyls == 0) ncyls = 1; /* XXX */ - if (cpg == 0) - cpg = DESCPG < ncyls ? DESCPG : ncyls; + /* + * By default we try to create MINCGS cylinder groups. For + * tiny filesystems, this is impractical. On large filesystems, + * cpg will be further limited to the largest possible size + * (restricted by the blocks/inodes per group) within mkfs(). + */ + if (!cpgflg) + cpg = ncyls < TINYFS ? ncyls : (ncyls + MINCGS - 1) / MINCGS; else if (cpg > ncyls) { cpg = ncyls; printf( Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message