summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_super.c
diff options
context:
space:
mode:
authorDave Chinner2015-02-23 11:19:53 +0100
committerDave Chinner2015-02-23 11:19:53 +0100
commite88b64ea1f3da64dbb52636377be295c90367377 (patch)
tree0031d3ed6f296981fdcd2b9f4cf3cebc8b557ab8 /fs/xfs/xfs_super.c
parentxfs: use generic percpu counters for inode counter (diff)
downloadkernel-qcow2-linux-e88b64ea1f3da64dbb52636377be295c90367377.tar.gz
kernel-qcow2-linux-e88b64ea1f3da64dbb52636377be295c90367377.tar.xz
kernel-qcow2-linux-e88b64ea1f3da64dbb52636377be295c90367377.zip
xfs: use generic percpu counters for free inode counter
XFS has hand-rolled per-cpu counters for the superblock since before there was any generic implementation. The free inode counter is not used for any limit enforcement - the per-AG free inode counters are used during allocation to determine if there are inode available for allocation. Hence we don't need any of the complexity of the hand-rolled counters and we can simply replace them with generic per-cpu counters similar to the inode counter. This version introduces a xfs_mod_ifree() helper function from Christoph Hellwig. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r--fs/xfs/xfs_super.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 0aa4428bfa31..049147776ee1 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1086,6 +1086,7 @@ xfs_fs_statfs(
struct xfs_inode *ip = XFS_I(dentry->d_inode);
__uint64_t fakeinos, id;
__uint64_t icount;
+ __uint64_t ifree;
xfs_extlen_t lsize;
__int64_t ffree;
@@ -1098,6 +1099,7 @@ xfs_fs_statfs(
xfs_icsb_sync_counters(mp, XFS_ICSB_LAZY_COUNT);
icount = percpu_counter_sum(&mp->m_icount);
+ ifree = percpu_counter_sum(&mp->m_ifree);
spin_lock(&mp->m_sb_lock);
statp->f_bsize = sbp->sb_blocksize;
@@ -1118,7 +1120,7 @@ xfs_fs_statfs(
sbp->sb_icount);
/* make sure statp->f_ffree does not underflow */
- ffree = statp->f_files - (icount - sbp->sb_ifree);
+ ffree = statp->f_files - (icount - ifree);
statp->f_ffree = max_t(__int64_t, ffree, 0);
spin_unlock(&mp->m_sb_lock);