xfs: active inodes stat is broken
authorDave Chinner <dchinner@redhat.com>
Wed, 3 Dec 2014 22:42:40 +0000 (09:42 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 3 Dec 2014 22:42:40 +0000 (09:42 +1100)
vn_active only ever gets decremented, so it has a very large
negative number.  Make it track the inode count we currently have
allocated properly so we can easily track the size of the inode
cache via tools like PCP.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_icache.c
fs/xfs/xfs_super.c

index b45f7b27b5dff8e7b0b3113ea8668edc03f1a805..f7a742eb0aaaf6250bfec5a49b3c5cf9c1affa47 100644 (file)
@@ -65,6 +65,7 @@ xfs_inode_alloc(
                return NULL;
        }
 
+       XFS_STATS_INC(vn_active);
        ASSERT(atomic_read(&ip->i_pincount) == 0);
        ASSERT(!spin_is_locked(&ip->i_flags_lock));
        ASSERT(!xfs_isiflocked(ip));
@@ -130,6 +131,7 @@ xfs_inode_free(
        /* asserts to verify all state is correct here */
        ASSERT(atomic_read(&ip->i_pincount) == 0);
        ASSERT(!xfs_isiflocked(ip));
+       XFS_STATS_DEC(vn_active);
 
        call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback);
 }
index a0f58d933261292e4bbe04f3aeeaae5fa8f6f2fb..45fa5b570eb5bbeaf6816cddef32935806c27bf8 100644 (file)
@@ -1008,7 +1008,6 @@ xfs_fs_evict_inode(
        clear_inode(inode);
        XFS_STATS_INC(vn_rele);
        XFS_STATS_INC(vn_remove);
-       XFS_STATS_DEC(vn_active);
 
        xfs_inactive(ip);
 }