Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs_lfs Address PR bin/7623: if the filesystem is so ...



details:   https://anonhg.NetBSD.org/src/rev/a40b7430642b
branches:  trunk
changeset: 474845:a40b7430642b
user:      perseant <perseant%NetBSD.org@localhost>
date:      Thu Jul 22 20:14:29 1999 +0000

description:
Address PR bin/7623: if the filesystem is so small (or segment size so large)
that not enough segments are available for the second superblock, or to have
MIN_FREE_SEGS free for work room for the cleaner, newfs_lfs will now exit
with an error.

diffstat:

 sbin/newfs_lfs/lfs.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 590a3f6f1ec9 -r a40b7430642b sbin/newfs_lfs/lfs.c
--- a/sbin/newfs_lfs/lfs.c      Thu Jul 22 20:10:16 1999 +0000
+++ b/sbin/newfs_lfs/lfs.c      Thu Jul 22 20:14:29 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.c,v 1.4 1999/06/24 16:45:14 perseant Exp $ */
+/*     $NetBSD: lfs.c,v 1.5 1999/07/22 20:14:29 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.4 1999/06/24 16:45:14 perseant Exp $");
+__RCSID("$NetBSD: lfs.c,v 1.5 1999/07/22 20:14:29 perseant Exp $");
 #endif
 #endif /* not lint */
 
@@ -290,6 +290,9 @@
        lfsp->lfs_nclean = lfsp->lfs_nseg = lfsp->lfs_dsize / lfsp->lfs_ssize;
        lfsp->lfs_maxfilesize = maxtable[lfsp->lfs_bshift] << lfsp->lfs_bshift;
 
+       if(lfsp->lfs_nseg < MIN_FREE_SEGS + 1)
+               fatal("Could not allocate %d segments; please decrease the segment size\n", MIN_FREE_SEGS+1);
+
        /* 
         * The number of free blocks is set from the number of segments times
         * the segment size - MIN_FREE_SEGS (that we never write because we need to make
@@ -324,6 +327,12 @@
                        break;
                lfsp->lfs_sboffs[i] = sb_addr;
        }
+
+       /* We need >= 2 superblocks */
+       if(lfsp->lfs_sboffs[1] == 0x0) {
+               fatal("Could not assign a disk adress for the second superblock.\nPlease decrease the segment size.\n");
+       }
+
        last_sb_addr = lfsp->lfs_sboffs[i - 1];
        lfsp->lfs_lastseg = lfsp->lfs_sboffs[0];
        lfsp->lfs_nextseg = 



Home | Main Index | Thread Index | Old Index