Source-Changes-HG archive

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

[src/trunk]: src/sbin/fsck_lfs Check/fix accounting of lfs_dmeta. Patch from...



details:   https://anonhg.NetBSD.org/src/rev/87ac709068dc
branches:  trunk
changeset: 499494:87ac709068dc
user:      perseant <perseant%NetBSD.org@localhost>
date:      Tue Nov 21 06:24:26 2000 +0000

description:
Check/fix accounting of lfs_dmeta.  Patch from Jesse Off
<joff%gci-net.com@localhost> (PR #11534).

diffstat:

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

diffs (49 lines):

diff -r 0574f623801a -r 87ac709068dc sbin/fsck_lfs/pass5.c
--- a/sbin/fsck_lfs/pass5.c     Tue Nov 21 06:14:40 2000 +0000
+++ b/sbin/fsck_lfs/pass5.c     Tue Nov 21 06:24:26 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass5.c,v 1.7 2000/11/13 00:30:48 perseant Exp $    */
+/* $NetBSD: pass5.c,v 1.8 2000/11/21 06:24:26 perseant Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -59,6 +59,7 @@
        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 */
 
        /*
@@ -68,6 +69,7 @@
        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) &&
@@ -97,6 +99,8 @@
                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);
@@ -112,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);



Home | Main Index | Thread Index | Old Index