]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/xfs/linux-2.6/xfs_super.c
xfs: make use of new shrinker callout for the inode cache
[mirror_ubuntu-zesty-kernel.git] / fs / xfs / linux-2.6 / xfs_super.c
index a1a881e68a9aa86a1aa76c27931e02202a57a08d..a9c6ccff7b485588c14fea00374c0e7070cca64a 100644 (file)
@@ -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 = {