Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs_lfs When creating a very small filesystem, use we...



details:   https://anonhg.NetBSD.org/src/rev/a8eb79ada883
branches:  trunk
changeset: 773438:a8eb79ada883
user:      perseant <perseant%NetBSD.org@localhost>
date:      Thu Feb 02 03:50:32 2012 +0000

description:
When creating a very small filesystem, use well-known small segment,
block and fragment sizes by default instead of the ordinary 1M/8k/1k
default for larger filesystems.

diffstat:

 sbin/newfs_lfs/config.h   |   9 +++++++--
 sbin/newfs_lfs/make_lfs.c |  18 +++++++++++++-----
 2 files changed, 20 insertions(+), 7 deletions(-)

diffs (77 lines):

diff -r 6e98837460c6 -r a8eb79ada883 sbin/newfs_lfs/config.h
--- a/sbin/newfs_lfs/config.h   Thu Feb 02 03:49:22 2012 +0000
+++ b/sbin/newfs_lfs/config.h   Thu Feb 02 03:50:32 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.h,v 1.8 2003/12/17 05:08:43 yamt Exp $  */
+/*     $NetBSD: config.h,v 1.9 2012/02/02 03:50:32 perseant Exp $      */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -40,7 +40,7 @@
  * 1/DFL_MIN_FREE_SEGS gives the fraction of segments to be reserved for
  * the cleaner.
  */
-#define DFL_MIN_FREE_SEGS 20
+#define DFL_MIN_FREE_SEGS 10
 
 /*
  * MINFREE gives the minimum acceptable percentage of file system
@@ -69,3 +69,8 @@
 #define DFL_LFS_FFSHIFT                10
 #define DFL_LFS_FBMASK         0x7
 #define DFL_LFS_FBSHIFT                3
+
+#define SMALL_FSSIZE           65536 /* sectors */
+#define SMALL_LFSSEG           32768
+#define SMALL_LFSBLOCK         1024
+#define SMALL_LFSFRAG          512
diff -r 6e98837460c6 -r a8eb79ada883 sbin/newfs_lfs/make_lfs.c
--- a/sbin/newfs_lfs/make_lfs.c Thu Feb 02 03:49:22 2012 +0000
+++ b/sbin/newfs_lfs/make_lfs.c Thu Feb 02 03:50:32 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make_lfs.c,v 1.17 2012/01/17 16:27:19 perseant Exp $   */
+/*     $NetBSD: make_lfs.c,v 1.18 2012/02/02 03:50:32 perseant Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c      8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: make_lfs.c,v 1.17 2012/01/17 16:27:19 perseant Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.18 2012/02/02 03:50:32 perseant Exp $");
 #endif
 #endif /* not lint */
 
@@ -355,12 +355,20 @@
                    "expected \"%s\"", dkw->dkw_ptype, DKW_PTYPE_LFS);
        }
 
-       if (!(bsize = block_size))
+       if (!(bsize = block_size)) {
                bsize = DFL_LFSBLOCK;
-       if (!(fsize = frag_size))
+               if (dkw->dkw_size <= SMALL_FSSIZE)
+                       bsize = SMALL_LFSBLOCK;
+       }
+       if (!(fsize = frag_size)) {
                fsize = DFL_LFSFRAG;
+               if (dkw->dkw_size <= SMALL_FSSIZE)
+                       fsize = SMALL_LFSFRAG;
+       }
        if (!(ssize = seg_size)) {
                ssize = DFL_LFSSEG;
+               if (dkw->dkw_size <= SMALL_FSSIZE)
+                       ssize = SMALL_LFSSEG;
        }
        if (version > 1) {
                if (ibsize == 0)
@@ -511,7 +519,7 @@
                        "segment size.\n", ssize, fs->lfs_bsize);
        }
        if(warned_segtoobig)
-               fprintf(stderr,"Using segment size %d.\n", ssize);
+               fprintf(stderr,"Using segment size %d, block size %d, frag size %d.\n", ssize, bsize, fsize);
 
        /*
         * Now that we've determined what we're going to do, announce it



Home | Main Index | Thread Index | Old Index