Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Use 32KB/4KB for default block/fragment size on >= 128 GB pa...



details:   https://anonhg.NetBSD.org/src/rev/739030d9288b
branches:  trunk
changeset: 779946:739030d9288b
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 30 15:34:01 2012 +0000

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

diffstat:

 distrib/utils/sysinst/label.c |  23 +++++++++++++++++++----
 sbin/newfs/newfs.8            |  22 ++++++++++++++--------
 sbin/newfs/newfs.c            |  15 ++++++++++-----
 3 files changed, 43 insertions(+), 17 deletions(-)

diffs (157 lines):

diff -r 5d0457423b3d -r 739030d9288b distrib/utils/sysinst/label.c
--- a/distrib/utils/sysinst/label.c     Sat Jun 30 15:03:56 2012 +0000
+++ b/distrib/utils/sysinst/label.c     Sat Jun 30 15:34:01 2012 +0000
@@ -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 @@
        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;
diff -r 5d0457423b3d -r 739030d9288b sbin/newfs/newfs.8
--- a/sbin/newfs/newfs.8        Sat Jun 30 15:03:56 2012 +0000
+++ b/sbin/newfs/newfs.8        Sat Jun 30 15:34:01 2012 +0000
@@ -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 @@
 .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 @@
 .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 @@
 .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
diff -r 5d0457423b3d -r 739030d9288b sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c        Sat Jun 30 15:03:56 2012 +0000
+++ b/sbin/newfs/newfs.c        Sat Jun 30 15:34:01 2012 +0000
@@ -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 @@
 #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 @@
  */
 /*
  * 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 @@
                                        fsize = S_DFL_FRAGSIZE;
                                else if (fssize < MEDIUM_FSSIZE)
                                        fsize = M_DFL_FRAGSIZE;
+                               else if (fssize < LARGE_FSSIZE)
+                                       fsize = L_DFL_FRAGSIZE;
                                else
-                                       fsize = L_DFL_FRAGSIZE;
+                                       fsize = LL_DFL_FRAGSIZE;
                                if (fsize < sectorsize)
                                        fsize = sectorsize;
                        }



Home | Main Index | Thread Index | Old Index