]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: remove metafile inodes from the active inode stat
authorChristoph Hellwig <hch@lst.de>
Mon, 2 Mar 2026 01:40:00 +0000 (17:40 -0800)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 8 Apr 2026 19:39:57 +0000 (21:39 +0200)
Source kernel commit: 47553dd60b1da88df2354f841a4f71dd4de6478a

The active inode (or active vnode until recently) stat can get much larger
than expected on file systems with a lot of metafile inodes like zoned
file systems on SMR hard disks with 10.000s of rtg rmap inodes.

Remove all metafile inodes from the active counter to make it more useful
to track actual workloads and add a separate counter for active metafile
inodes.

This fixes xfs/177 on SMR hard drives.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_inode_buf.c
libxfs/xfs_metafile.c

index 0802bc376073d82702b0ac4a4689bdfdc077dd12..f56aef0dbb3db9b387f5b806cf6465a360cbb96d 100644 (file)
@@ -265,6 +265,10 @@ xfs_inode_from_disk(
        }
        if (xfs_is_reflink_inode(ip))
                xfs_ifork_init_cow(ip);
+       if (xfs_is_metadir_inode(ip)) {
+               XFS_STATS_DEC(ip->i_mount, xs_inodes_active);
+               XFS_STATS_INC(ip->i_mount, xs_inodes_meta);
+       }
        return 0;
 
 out_destroy_data_fork:
index 8d98989349d0867153284b4a4eab96f106276fce..bab5d7e29ae9a760110951fabf5f257c51ea12d7 100644 (file)
@@ -59,6 +59,9 @@ xfs_metafile_set_iflag(
        ip->i_diflags2 |= XFS_DIFLAG2_METADATA;
        ip->i_metatype = metafile_type;
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+
+       XFS_STATS_DEC(ip->i_mount, xs_inodes_active);
+       XFS_STATS_INC(ip->i_mount, xs_inodes_meta);
 }
 
 /* Clear the metadata directory inode flag. */
@@ -72,6 +75,8 @@ xfs_metafile_clear_iflag(
 
        ip->i_diflags2 &= ~XFS_DIFLAG2_METADATA;
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+       XFS_STATS_INC(ip->i_mount, xs_inodes_active);
+       XFS_STATS_DEC(ip->i_mount, xs_inodes_meta);
 }
 
 /*