svn commit: r183821 - head/sbin/fsck_ffs

Konstantin Belousov kib at FreeBSD.org
Mon Oct 13 14:01:06 UTC 2008


Author: kib
Date: Mon Oct 13 14:01:05 2008
New Revision: 183821
URL: http://svn.freebsd.org/changeset/base/183821

Log:
  Background fsck applies twice some summary totals changes. The next
  background fsck on the same file system might then print negative
  numbers for reclaimed directories/files/fragments.
  
  Address the issue in a limited degree, by using old summary data for
  cg when bgfsck is performed.
  
  Submitted by:	tegge
  MFC after:	1 week

Modified:
  head/sbin/fsck_ffs/pass5.c

Modified: head/sbin/fsck_ffs/pass5.c
==============================================================================
--- head/sbin/fsck_ffs/pass5.c	Mon Oct 13 13:56:23 2008	(r183820)
+++ head/sbin/fsck_ffs/pass5.c	Mon Oct 13 14:01:05 2008	(r183821)
@@ -291,10 +291,17 @@ pass5(void)
 				sump[run]++;
 			}
 		}
-		cstotal.cs_nffree += newcg->cg_cs.cs_nffree;
-		cstotal.cs_nbfree += newcg->cg_cs.cs_nbfree;
-		cstotal.cs_nifree += newcg->cg_cs.cs_nifree;
-		cstotal.cs_ndir += newcg->cg_cs.cs_ndir;
+		if (bkgrdflag != 0) {
+			cstotal.cs_nffree += cg->cg_cs.cs_nffree;
+			cstotal.cs_nbfree += cg->cg_cs.cs_nbfree;
+			cstotal.cs_nifree += cg->cg_cs.cs_nifree;
+			cstotal.cs_ndir += cg->cg_cs.cs_ndir;
+		} else {
+			cstotal.cs_nffree += newcg->cg_cs.cs_nffree;
+			cstotal.cs_nbfree += newcg->cg_cs.cs_nbfree;
+			cstotal.cs_nifree += newcg->cg_cs.cs_nifree;
+			cstotal.cs_ndir += newcg->cg_cs.cs_ndir;
+		}
 		cs = &fs->fs_cs(fs, c);
 		if (cursnapshot == 0 &&
 		    memcmp(&newcg->cg_cs, cs, sizeof *cs) != 0 &&


More information about the svn-src-head mailing list