Module Name:    src
Committed By:   tsutsui
Date:           Sat Jun 30 15:34:02 UTC 2012

Modified Files:
        src/distrib/utils/sysinst: label.c
        src/sbin/newfs: newfs.8 newfs.c

Log Message:
Use 32KB/4KB for default block/fragment size on >= 128 GB partitions
for modern AFT disks.  No particular comments against PR install/46629.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/distrib/utils/sysinst/label.c
cvs rdiff -u -r1.82 -r1.83 src/sbin/newfs/newfs.8
cvs rdiff -u -r1.110 -r1.111 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/label.c
diff -u src/distrib/utils/sysinst/label.c:1.61 src/distrib/utils/sysinst/label.c:1.62
--- src/distrib/utils/sysinst/label.c:1.61	Thu Jan  5 22:18:36 2012
+++ src/distrib/utils/sysinst/label.c	Sat Jun 30 15:34:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.61 2012/01/05 22:18:36 christos Exp $	*/
+/*	$NetBSD: label.c,v 1.62 2012/06/30 15:34:01 tsutsui Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.61 2012/01/05 22:18:36 christos Exp $");
+__RCSID("$NetBSD: label.c,v 1.62 2012/06/30 15:34:01 tsutsui Exp $");
 #endif
 
 #include <sys/types.h>
@@ -213,8 +213,23 @@ set_ptype(partinfo *p, int fstype, int f
 	p->pi_fstype = fstype;
 	if (fstype == FS_BSDFFS || fstype == FS_BSDLFS) {
 		p->pi_frag = 8;
-		/* match newfs defaults for fragments size (2k if >= 1024MB) */
-		p->pi_fsize = p->pi_size > 1024*1024*1024 / 512 ? 2048 : 1024;
+		/*
+		 * match newfs defaults for fragments size:
+		 * fs size	frag size
+		 * < 20 MB	0.5 KB
+		 * < 1000 MB	1 KB
+		 * < 128 GB	2 KB
+		 * >= 128 GB	4 KB
+		 */
+	 	/* note pi_size is uint32_t so we have to avoid overflow */
+		if (p->pi_size < (20 * 1024 * (1024 / 512)))
+			p->pi_fsize = 512;
+		else if (p->pi_size < (1000 * 1024 * (1024 / 512)))
+			p->pi_fsize = 1024;
+		else if (p->pi_size < (128 * 1024 * 1024 * (1024 / 512)))
+			p->pi_fsize = 2048;
+		else
+			p->pi_fsize = 4096;
 	} else {
 		/* zero - fields not used */
 		p->pi_frag = 0;

Index: src/sbin/newfs/newfs.8
diff -u src/sbin/newfs/newfs.8:1.82 src/sbin/newfs/newfs.8:1.83
--- src/sbin/newfs/newfs.8:1.82	Sat May 14 19:46:10 2011
+++ src/sbin/newfs/newfs.8	Sat Jun 30 15:34:01 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: newfs.8,v 1.82 2011/05/14 19:46:10 dholland Exp $
+.\"	$NetBSD: newfs.8,v 1.83 2012/06/30 15:34:01 tsutsui Exp $
 .\"
 .\" Copyright (c) 1983, 1987, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)newfs.8	8.6 (Berkeley) 5/3/95
 .\"
-.Dd May 14, 2011
+.Dd June 30, 2012
 .Dt NEWFS 8
 .Os
 .Sh NAME
@@ -111,10 +111,12 @@ The default size depends upon the size o
 .Ar block-size
 .It \*[Lt] 20 MB
 4 KB
-.It \*[Lt] 1024 MB
+.It \*[Lt] 1000 MB
 8 KB
-.It \*[Gt]= 1024 MB
+.It \*[Lt] 128 GB
 16 KB
+.It \*[Gt]= 128 GB
+32 KB
 .El
 .It Fl d Ar maxbsize
 Set the maximum extent size to
@@ -151,10 +153,12 @@ The default size depends upon the size o
 .Ar frag-size
 .It \*[Lt] 20 MB
 0.5 KB
-.It \*[Lt] 1024 MB
+.It \*[Lt] 1000 MB
 1 KB
-.It \*[Gt]= 1024 MB
+.It \*[Lt] 128 GB
 2 KB
+.It \*[Gt]= 128 GB
+4 KB
 .El
 .It Fl G
 Treat garbage parameters as non-fatal.
@@ -182,10 +186,12 @@ bytes of data space:
 .Ar bytes-per-inode
 .It \*[Lt] 20 MB
 2 KB
-.It \*[Lt] 1024 MB
+.It \*[Lt] 1000 MB
 4 KB
-.It \*[Gt]= 1024 MB
+.It \*[Lt] 128 GB
 8 KB
+.It \*[Gt]= 128 GB
+16 KB
 .El
 .It Fl m Ar free-space
 The percentage of space reserved from normal users; the minimum free

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.110 src/sbin/newfs/newfs.c:1.111
--- src/sbin/newfs/newfs.c:1.110	Mon Feb 13 12:59:56 2012
+++ src/sbin/newfs/newfs.c	Sat Jun 30 15:34:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.110 2012/02/13 12:59:56 wiz Exp $	*/
+/*	$NetBSD: newfs.c,v 1.111 2012/06/30 15:34:01 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.110 2012/02/13 12:59:56 wiz Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.111 2012/06/30 15:34:01 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -157,14 +157,17 @@ const char lmsg[] = "%s: can't read disk
  */
 /*
  * For file systems smaller than SMALL_FSSIZE we use the S_DFL_* defaults,
- * otherwise if less than MEDIUM_FSSIZE use M_DFL_*, otherwise use
- * L_DFL_*.
+ * otherwise if less than MEDIUM_FSSIZE use M_DFL_*,
+ * otherwise if less than LARGE_FSSIZE use L_DFL_*,
+ * otherwise use LL_DFL_* especially for modern AFT disks.
  */
 #define	SMALL_FSSIZE	(20*1024*2)
 #define	S_DFL_FRAGSIZE	512
 #define	MEDIUM_FSSIZE	(1000*1024*2)
 #define	M_DFL_FRAGSIZE	1024
+#define	LARGE_FSSIZE	(128*1024*1024*2)
 #define	L_DFL_FRAGSIZE	2048
+#define	LL_DFL_FRAGSIZE	4096
 #define	DFL_FRAG_BLK	8
 
 /* Apple requires the fragment size to be at least APPLEUFS_DIRBLKSIZ
@@ -624,8 +627,10 @@ main(int argc, char *argv[])
 					fsize = S_DFL_FRAGSIZE;
 				else if (fssize < MEDIUM_FSSIZE)
 					fsize = M_DFL_FRAGSIZE;
-				else
+				else if (fssize < LARGE_FSSIZE)
 					fsize = L_DFL_FRAGSIZE;
+				else
+					fsize = LL_DFL_FRAGSIZE;
 				if (fsize < sectorsize)
 					fsize = sectorsize;
 			}

Reply via email to