Module Name: src
Committed By: perseant
Date: Thu Feb 2 03:50:32 UTC 2012
Modified Files:
src/sbin/newfs_lfs: config.h make_lfs.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/newfs_lfs/config.h
cvs rdiff -u -r1.17 -r1.18 src/sbin/newfs_lfs/make_lfs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/newfs_lfs/config.h
diff -u src/sbin/newfs_lfs/config.h:1.8 src/sbin/newfs_lfs/config.h:1.9
--- src/sbin/newfs_lfs/config.h:1.8 Wed Dec 17 05:08:43 2003
+++ src/sbin/newfs_lfs/config.h Thu Feb 2 03:50:32 2012
@@ -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
Index: src/sbin/newfs_lfs/make_lfs.c
diff -u src/sbin/newfs_lfs/make_lfs.c:1.17 src/sbin/newfs_lfs/make_lfs.c:1.18
--- src/sbin/newfs_lfs/make_lfs.c:1.17 Tue Jan 17 16:27:19 2012
+++ src/sbin/newfs_lfs/make_lfs.c Thu Feb 2 03:50:32 2012
@@ -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 @@ make_lfs(int devfd, uint secsize, struct
"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 @@ make_lfs(int devfd, uint secsize, struct
"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