Source-Changes-HG archive

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

[src/trunk]: src Report, and detect and correct inconsistencies in, the numbe...



details:   https://anonhg.NetBSD.org/src/rev/c2fe2e557830
branches:  trunk
changeset: 499142:c2fe2e557830
user:      perseant <perseant%NetBSD.org@localhost>
date:      Mon Nov 13 00:30:48 2000 +0000

description:
Report, and detect and correct inconsistencies in, the number of clean
segments.  Patches from Jesse Off <joff%gci-net.com@localhost> (PR #11470).

diffstat:

 sbin/fsck_lfs/pass5.c      |  13 ++++++++++++-
 usr.sbin/dumplfs/dumplfs.c |  33 +++++++++++++--------------------
 2 files changed, 25 insertions(+), 21 deletions(-)

diffs (122 lines):

diff -r 840e742f09bf -r c2fe2e557830 sbin/fsck_lfs/pass5.c
--- a/sbin/fsck_lfs/pass5.c     Mon Nov 13 00:24:30 2000 +0000
+++ b/sbin/fsck_lfs/pass5.c     Mon Nov 13 00:30:48 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass5.c,v 1.6 2000/09/09 04:49:56 perseant Exp $    */
+/* $NetBSD: pass5.c,v 1.7 2000/11/13 00:30:48 perseant Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -59,11 +59,13 @@
        unsigned long   bb; /* total number of used blocks (lower bound) */
        unsigned long   ubb; /* upper bound number of used blocks */
        unsigned long   avail; /* blocks available for writing */
+       int             nclean; /* clean segments */
 
        /*
         * Check segment holdings against actual holdings.  Check for
         * "clean" segments that contain live data.
         */
+       nclean = 0;
        avail = 0;
        bb = ubb = 0;
        for (i = 0; i < sblock.lfs_nseg; i++) {
@@ -96,6 +98,7 @@
                        bb += btodb(su->su_nbytes) + su->su_nsums;
                        ubb += btodb(su->su_nbytes) + su->su_nsums + fsbtodb(&sblock, su->su_ninos);
                } else {
+                       nclean++;
                        avail += fsbtodb(&sblock, sblock.lfs_ssize);
                        if (su->su_flags & SEGUSE_SUPERBLOCK)
                                avail -= btodb(LFS_SBPAD);
@@ -117,6 +120,14 @@
                        sbdirty();
                }
        }
+       if (nclean != sblock.lfs_nclean) {
+               pwarn("nclean given as %d, should be %d\n", sblock.lfs_nclean,
+                     nclean);
+               if (preen || reply("fix")) {
+                       sblock.lfs_nclean = nclean;
+                       sbdirty();
+               }
+       }
        if (sblock.lfs_bfree > sblock.lfs_dsize - bb ||
            sblock.lfs_bfree < sblock.lfs_dsize - ubb) {
                pwarn("bfree given as %d, should be between %ld and %ld\n",
diff -r 840e742f09bf -r c2fe2e557830 usr.sbin/dumplfs/dumplfs.c
--- a/usr.sbin/dumplfs/dumplfs.c        Mon Nov 13 00:24:30 2000 +0000
+++ b/usr.sbin/dumplfs/dumplfs.c        Mon Nov 13 00:30:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dumplfs.c,v 1.16 2000/08/25 05:27:49 toshii Exp $      */
+/*     $NetBSD: dumplfs.c,v 1.17 2000/11/13 00:30:48 perseant Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -45,7 +45,7 @@
 #if 0
 static char sccsid[] = "@(#)dumplfs.c  8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: dumplfs.c,v 1.16 2000/08/25 05:27:49 toshii Exp $");
+__RCSID("$NetBSD: dumplfs.c,v 1.17 2000/11/13 00:30:48 perseant Exp $");
 #endif
 #endif /* not lint */
 
@@ -616,6 +616,11 @@
                "cksum    ", lfsp->lfs_cksum,
                "maxfilesize  ", (long long)lfsp->lfs_maxfilesize);
 
+       (void)printf("%s%d\t%s%d\t%s%d\n",
+               "nclean   ", lfsp->lfs_nclean,
+               "dmeta    ", lfsp->lfs_dmeta,
+               "minfreeseg ", lfsp->lfs_minfreeseg);
+
        (void)printf("Superblock disk addresses:\t");
        for (i = 0; i < LFS_MAXNUMSB; i++) {
                (void)printf(" 0x%x", lfsp->lfs_sboffs[i]);
@@ -630,9 +635,9 @@
                "idaddr   ", lfsp->lfs_idaddr,
                "ifile    ", lfsp->lfs_ifile);
        (void)printf("%s%d\t%s%d\t%s%d\n",
+               "uinodes  ", lfsp->lfs_uinodes,
                "bfree    ", lfsp->lfs_bfree,
-               "avail    ", lfsp->lfs_avail,
-               "uinodes  ", lfsp->lfs_uinodes);
+               "avail    ", lfsp->lfs_avail);
        (void)printf("%s%d\t%s0x%x\t%s0x%x\n%s0x%x\t%s0x%x\t",
                "nfiles   ", lfsp->lfs_nfiles,
                "lastseg  ", lfsp->lfs_lastseg,
@@ -640,20 +645,6 @@
                "curseg   ", lfsp->lfs_curseg,
                "offset   ", lfsp->lfs_offset);
        (void)printf("tstamp   %s", ctime((time_t *)&lfsp->lfs_tstamp));
-#if 0  /* This is no longer stored on disk! --ks */
-       (void)printf("\nIn-Memory Information\n");
-       (void)printf("%s%d\t%s0x%x\t%s%d%s%d\t%s%d\n",
-               "seglock  ", lfsp->lfs_seglock,
-               "iocount  ", lfsp->lfs_iocount,
-               "writer   ", lfsp->lfs_writer,
-               "dirops   ", lfsp->lfs_dirops,
-               "doifile  ", lfsp->lfs_doifile);
-       (void)printf("%s%d\t%s%d\t%s0x%x\t%s%d\n",
-               "nactive  ", lfsp->lfs_nactive,
-               "fmod     ", lfsp->lfs_fmod,
-               "clean    ", lfsp->lfs_clean,
-               "ronly    ", lfsp->lfs_ronly);
-#endif
 }
 
 static void
@@ -677,8 +668,10 @@
        CLEANERINFO *cip;
 
        cip = (CLEANERINFO *)ipage;
-       (void)printf("segments clean\t%d\tsegments dirty\t%d\n\n",
-           cip->clean, cip->dirty);
+       (void)printf("clean\t%d\tdirty\t%d\n",
+                    cip->clean, cip->dirty);
+       (void)printf("bfree\t%d\tavail\t%d\n\n",
+                    cip->bfree, cip->avail);
 }
 
 static void



Home | Main Index | Thread Index | Old Index