xfs
[Top] [All Lists]

[PATCH v2] xfs: active inodes stat is broken

To: Mark Tinguely <tinguely@xxxxxxx>
Subject: [PATCH v2] xfs: active inodes stat is broken
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 3 Dec 2014 09:34:52 +1100
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20141202210204.GA18131@dastard>
References: <1417473270-17467-1-git-send-email-david@xxxxxxxxxxxxx> <547DC411.3090202@xxxxxxx> <20141202210204.GA18131@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
From: Dave Chinner <dchinner@xxxxxxxxxx>

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@xxxxxxxxxx>
---
Version 2:
- move stat increment to inode allocation code rather than cache
  miss code so that inc/dec are evenly balanced no matter who calls
  them.

 fs/xfs/xfs_icache.c | 2 ++
 fs/xfs/xfs_super.c  | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 92ca910..9771b7e 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -63,6 +63,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));
@@ -128,6 +129,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);
 }
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index fee11c8..6b95851 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1005,7 +1005,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);
 }

<Prev in Thread] Current Thread [Next in Thread>