Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sbin/fsck_lfs Pull up revisions 1.7-1.8 (requested by p...



details:   https://anonhg.NetBSD.org/src/rev/7bb315f51347
branches:  netbsd-1-5
changeset: 490623:7bb315f51347
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 03 21:45:40 2001 +0000

description:
Pull up revisions 1.7-1.8 (requested by perseant):
  Report/fix lfs_nclean inconsistencies.
  Report/fix lfs_dmeta inconsistencies.

diffstat:

 sbin/fsck_lfs/pass5.c |  25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diffs (68 lines):

diff -r 4e90b8419bbb -r 7bb315f51347 sbin/fsck_lfs/pass5.c
--- a/sbin/fsck_lfs/pass5.c     Sat Feb 03 21:44:03 2001 +0000
+++ b/sbin/fsck_lfs/pass5.c     Sat Feb 03 21:45:40 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass5.c,v 1.5.2.1 2000/09/14 18:53:21 perseant Exp $        */
+/* $NetBSD: pass5.c,v 1.5.2.2 2001/02/03 21:45:40 he Exp $      */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -59,13 +59,17 @@
        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 */
+       unsigned long   dmeta; /* blocks in segsums and inodes */
+       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;
+       dmeta = 0;
        for (i = 0; i < sblock.lfs_nseg; i++) {
                su = lfs_gseguse(i, &bp);
                if (!(su->su_flags & SEGUSE_DIRTY) &&
@@ -95,7 +99,10 @@
                if (su->su_flags & SEGUSE_DIRTY) {
                        bb += btodb(su->su_nbytes) + su->su_nsums;
                        ubb += btodb(su->su_nbytes) + su->su_nsums + fsbtodb(&sblock, su->su_ninos);
+                       dmeta += btodb(LFS_SUMMARY_SIZE * su->su_nsums);
+                       dmeta += fsbtodb(&sblock, su->su_ninos);
                } else {
+                       nclean++;
                        avail += fsbtodb(&sblock, sblock.lfs_ssize);
                        if (su->su_flags & SEGUSE_SUPERBLOCK)
                                avail -= btodb(LFS_SBPAD);
@@ -109,6 +116,14 @@
        avail -= fsbtodb(&sblock, sblock.lfs_ssize) *
                (sblock.lfs_minfreeseg - (sblock.lfs_minfreeseg / 2));
 
+       if (dmeta != sblock.lfs_dmeta) { 
+               pwarn("dmeta given as %d, should be %ld\n", sblock.lfs_dmeta, 
+                       dmeta); 
+               if (preen || reply("fix")) { 
+                       sblock.lfs_dmeta = dmeta; 
+                       sbdirty(); 
+               } 
+       }
        if (avail != sblock.lfs_avail) {
                pwarn("avail given as %d, should be %ld\n", sblock.lfs_avail,
                      avail);
@@ -117,6 +132,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",



Home | Main Index | Thread Index | Old Index