xfs: don't expect xfs headers to be in subdirectories
[firefly-linux-kernel-4.4.55.git] / fs / xfs / linux-2.6 / xfs_super.c
index a1a881e68a9aa86a1aa76c27931e02202a57a08d..9a72dda58bd0539fb14c33b42f79e52c5197945a 100644 (file)
@@ -33,7 +33,6 @@
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_btree.h"
-#include "xfs_btree_trace.h"
 #include "xfs_ialloc.h"
 #include "xfs_bmap.h"
 #include "xfs_rtalloc.h"
@@ -1025,11 +1024,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);
 
        /*
@@ -1412,36 +1406,31 @@ xfs_fs_fill_super(
        sb->s_time_gran = 1;
        set_posix_acl_flag(sb);
 
-       error = xfs_syncd_init(mp);
+       error = xfs_mountfs(mp);
        if (error)
                goto out_filestream_unmount;
 
-       xfs_inode_shrinker_register(mp);
-
-       error = xfs_mountfs(mp);
+       error = xfs_syncd_init(mp);
        if (error)
-               goto out_syncd_stop;
+               goto out_unmount;
 
        root = igrab(VFS_I(mp->m_rootip));
        if (!root) {
                error = ENOENT;
-               goto fail_unmount;
+               goto out_syncd_stop;
        }
        if (is_bad_inode(root)) {
                error = EINVAL;
-               goto fail_vnrele;
+               goto out_syncd_stop;
        }
        sb->s_root = d_alloc_root(root);
        if (!sb->s_root) {
                error = ENOMEM;
-               goto fail_vnrele;
+               goto out_iput;
        }
 
        return 0;
 
- out_syncd_stop:
-       xfs_inode_shrinker_unregister(mp);
-       xfs_syncd_stop(mp);
  out_filestream_unmount:
        xfs_filestream_unmount(mp);
  out_free_sb:
@@ -1456,18 +1445,11 @@ xfs_fs_fill_super(
  out:
        return -error;
 
- fail_vnrele:
-       if (sb->s_root) {
-               dput(sb->s_root);
-               sb->s_root = NULL;
-       } else {
-               iput(root);
-       }
-
- fail_unmount:
-       xfs_inode_shrinker_unregister(mp);
+ out_iput:
+       iput(root);
+ out_syncd_stop:
        xfs_syncd_stop(mp);
-
+ out_unmount:
        /*
         * Blow away any referenced inode in the filestreams cache.
         * This can and will cause log traffic as inodes go inactive
@@ -1491,6 +1473,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 +1501,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 = {