Subject: lfs_stats.segs_reclaimed always incremented?
To: None <tech-kern@netbsd.org>
From: Juan RP <juan@xtrarom.org>
List: tech-kern
Date: 05/25/2005 02:22:18
Hi,

I have disabled the LFS stats via sysctl vfs.lfs.dostats, but
vfs.lfs.stats.segs_reclaimed is always incremented:

vfs.lfs.dostats = 0
vfs.lfs.pagetrip = 0
vfs.lfs.stats.segsused = 0
vfs.lfs.stats.psegwrites = 0
vfs.lfs.stats.psyncwrites = 0
vfs.lfs.stats.pcleanwrites = 0
vfs.lfs.stats.blocktot = 0
vfs.lfs.stats.cleanblocks = 0
vfs.lfs.stats.ncheckpoints = 0
vfs.lfs.stats.nwrites = 0
vfs.lfs.stats.nsync_writes = 0
vfs.lfs.stats.wait_exceeded = 0
vfs.lfs.stats.write_exceeded = 0
vfs.lfs.stats.flush_invoked = 0
vfs.lfs.stats.vflush_invoked = 0
vfs.lfs.stats.clean_inlocked = 0
vfs.lfs.stats.clean_vnlocked = 0
vfs.lfs.stats.segs_reclaimed = 805

Shouldn't vfs.lfs.stats.segs_reclaimed be 0 in this case?

Index: lfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/lfs/lfs_syscalls.c,v
retrieving revision 1.106
diff -u -r1.106 lfs_syscalls.c
--- lfs_syscalls.c      20 May 2005 19:48:25 -0000      1.106
+++ lfs_syscalls.c      25 May 2005 00:15:22 -0000
@@ -877,6 +877,7 @@
 int
 lfs_do_segclean(struct lfs *fs, unsigned long segnum)
 {
+      extern int lfs_dostats;
        struct buf *bp;
        CLEANERINFO *cip;
        SEGUSE *sup;
@@ -933,7 +934,8 @@
        (void) LFS_BWRITE_LOG(bp);
        wakeup(&fs->lfs_avail);
 
-       ++lfs_stats.segs_reclaimed;
+      if (lfs_dostats)
+               ++lfs_stats.segs_reclaimed;
 
        return (0);
 }