summaryrefslogtreecommitdiff
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-07-08 08:14:46 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-21 04:47:42 +0400
commit8daaa83145ef1f0a146680618328dbbd0fa76939 (patch)
tree8ca49f03ed2fc4dada7283a6e109b13e3fb5501e /fs/xfs/linux-2.6/xfs_super.c
parent8ab47664d51a69ea79fe70bb07ca80664f74f76b (diff)
downloadlinux-8daaa83145ef1f0a146680618328dbbd0fa76939.tar.xz
xfs: make use of new shrinker callout for the inode cache
Convert the inode reclaim shrinker to use the new per-sb shrinker operations. This allows much bigger reclaim batches to be used, and allows the XFS inode cache to be shrunk in proportion with the VFS dentry and inode caches. This avoids the problem of the VFS caches being shrunk significantly before the XFS inode cache is shrunk resulting in imbalances in the caches during reclaim. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index a1a881e68a9a..a9c6ccff7b48 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1025,11 +1025,6 @@ xfs_fs_put_super(
{
struct xfs_mount *mp = XFS_M(sb);
- /*
- * Unregister the memory shrinker before we tear down the mount
- * structure so we don't have memory reclaim racing with us here.
- */
- xfs_inode_shrinker_unregister(mp);
xfs_syncd_stop(mp);
/*
@@ -1416,8 +1411,6 @@ xfs_fs_fill_super(
if (error)
goto out_filestream_unmount;
- xfs_inode_shrinker_register(mp);
-
error = xfs_mountfs(mp);
if (error)
goto out_syncd_stop;
@@ -1440,7 +1433,6 @@ xfs_fs_fill_super(
return 0;
out_syncd_stop:
- xfs_inode_shrinker_unregister(mp);
xfs_syncd_stop(mp);
out_filestream_unmount:
xfs_filestream_unmount(mp);
@@ -1465,7 +1457,6 @@ xfs_fs_fill_super(
}
fail_unmount:
- xfs_inode_shrinker_unregister(mp);
xfs_syncd_stop(mp);
/*
@@ -1491,6 +1482,21 @@ xfs_fs_mount(
return mount_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super);
}
+static int
+xfs_fs_nr_cached_objects(
+ struct super_block *sb)
+{
+ return xfs_reclaim_inodes_count(XFS_M(sb));
+}
+
+static void
+xfs_fs_free_cached_objects(
+ struct super_block *sb,
+ int nr_to_scan)
+{
+ xfs_reclaim_inodes_nr(XFS_M(sb), nr_to_scan);
+}
+
static const struct super_operations xfs_super_operations = {
.alloc_inode = xfs_fs_alloc_inode,
.destroy_inode = xfs_fs_destroy_inode,
@@ -1504,6 +1510,8 @@ static const struct super_operations xfs_super_operations = {
.statfs = xfs_fs_statfs,
.remount_fs = xfs_fs_remount,
.show_options = xfs_fs_show_options,
+ .nr_cached_objects = xfs_fs_nr_cached_objects,
+ .free_cached_objects = xfs_fs_free_cached_objects,
};
static struct file_system_type xfs_fs_type = {