Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs_lfs newfs_lfs now recognizes a zero p_sgs field t...



details:   https://anonhg.NetBSD.org/src/rev/3e2055b21947
branches:  trunk
changeset: 480732:3e2055b21947
user:      perseant <perseant%NetBSD.org@localhost>
date:      Tue Jan 18 21:57:59 2000 +0000

description:
newfs_lfs now recognizes a zero p_sgs field to mean "use the default segment
size" (for consistency with bsize/fsize, and since segment size == block
size is never a valid combination).

Updated the man page to include explicit reasonable values for fsize, bsize,
and sgs, at suggestion from Hubert Feyrer.

diffstat:

 sbin/newfs_lfs/lfs.c       |   9 ++++++---
 sbin/newfs_lfs/newfs_lfs.8 |  19 +++++++++++++------
 2 files changed, 19 insertions(+), 9 deletions(-)

diffs (73 lines):

diff -r 8638d38b665a -r 3e2055b21947 sbin/newfs_lfs/lfs.c
--- a/sbin/newfs_lfs/lfs.c      Tue Jan 18 21:52:38 2000 +0000
+++ b/sbin/newfs_lfs/lfs.c      Tue Jan 18 21:57:59 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.c,v 1.7 2000/01/18 00:02:29 perseant Exp $ */
+/*     $NetBSD: lfs.c,v 1.8 2000/01/18 21:57:59 perseant Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c      8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: lfs.c,v 1.7 2000/01/18 00:02:29 perseant Exp $");
+__RCSID("$NetBSD: lfs.c,v 1.8 2000/01/18 21:57:59 perseant Exp $");
 #endif
 #endif /* not lint */
 
@@ -242,8 +242,11 @@
                if (!(fsize = partp->p_frag))
                        fsize = DFL_LFSFRAG;
        if (!(ssize = seg_size))
-               if (!(ssize = (partp->p_fsize * partp->p_frag) << partp->p_sgs))
+               if (partp->p_sgs == 0 ||
+                   !(ssize = (partp->p_fsize * partp->p_frag) << partp->p_sgs))
+               {
                        ssize = DFL_LFSSEG;
+               }
 
        /* Sanity check: fsize<=bsize<ssize */
        if (fsize > bsize) {
diff -r 8638d38b665a -r 3e2055b21947 sbin/newfs_lfs/newfs_lfs.8
--- a/sbin/newfs_lfs/newfs_lfs.8        Tue Jan 18 21:52:38 2000 +0000
+++ b/sbin/newfs_lfs/newfs_lfs.8        Tue Jan 18 21:57:59 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: newfs_lfs.8,v 1.4 2000/01/18 00:02:29 perseant Exp $
+.\"    $NetBSD: newfs_lfs.8,v 1.5 2000/01/18 21:57:59 perseant Exp $
 .\"
 .\" Copyright (c) 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -47,20 +47,27 @@
 .Nm
 builds a log-structured file system on the specified special
 device basing its defaults on the information in the disk label.
-(Before running 
+Before running 
 .Nm
 the disk must be labeled using 
 .Xr disklabel 8 ,
-the proper fstype is 4.4LFS.)
+the proper fstype is 4.4LFS.  Reasonable values for the
+.Li fsize, 
+.Li bsize,
+and
+.Li cpg
+(really 
+.Li sgs,
+segment shift) fields are 1024, 8192, and 7 respectively.
 .Pp
 The following options define the general layout policies.
 .Bl -tag -width Fl
 .It Fl B
 The logical segment size of the file system in bytes.  If not specified,
 the segment size is computed by left-shifting the partition label's block
-size by the amount indicated in the partition table's segshift.  (A reasonable
-value for the segshift field in the disklabel is 7, which gives 1M segments
-for 8K blocks.)
+size by the amount indicated in the partition table's segshift.  If the
+disklabel indicates a zero block size or segment shift, a compile-time default
+segment size of 1M is used.
 .It Fl b Ar block-size
 The block size of the file system in bytes.  If not specified, the block
 size is taken from the partition label, or if the partition label



Home | Main Index | Thread Index | Old Index