Merge tag 'writeback' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_super.c
index 5b806f23ad0a48990d0a8a2408ca87c4d1634ea8..0d9de41a7151568621cfad89a1a95a97b2ba8b4a 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include "xfs.h"
-#include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
 #include "xfs_trans.h"
@@ -622,7 +621,7 @@ void
 xfs_blkdev_issue_flush(
        xfs_buftarg_t           *buftarg)
 {
-       blkdev_issue_flush(buftarg->bt_bdev, GFP_KERNEL, NULL);
+       blkdev_issue_flush(buftarg->bt_bdev, GFP_NOFS, NULL);
 }
 
 STATIC void
@@ -773,8 +772,14 @@ xfs_init_mount_workqueues(
        if (!mp->m_unwritten_workqueue)
                goto out_destroy_data_iodone_queue;
 
+       mp->m_cil_workqueue = alloc_workqueue("xfs-cil/%s",
+                       WQ_MEM_RECLAIM, 0, mp->m_fsname);
+       if (!mp->m_cil_workqueue)
+               goto out_destroy_unwritten;
        return 0;
 
+out_destroy_unwritten:
+       destroy_workqueue(mp->m_unwritten_workqueue);
 out_destroy_data_iodone_queue:
        destroy_workqueue(mp->m_data_workqueue);
 out:
@@ -785,6 +790,7 @@ STATIC void
 xfs_destroy_mount_workqueues(
        struct xfs_mount        *mp)
 {
+       destroy_workqueue(mp->m_cil_workqueue);
        destroy_workqueue(mp->m_data_workqueue);
        destroy_workqueue(mp->m_unwritten_workqueue);
 }
@@ -981,18 +987,9 @@ xfs_fs_put_super(
 {
        struct xfs_mount        *mp = XFS_M(sb);
 
-       xfs_syncd_stop(mp);
-
-       /*
-        * Blow away any referenced inode in the filestreams cache.
-        * This can and will cause log traffic as inodes go inactive
-        * here.
-        */
        xfs_filestream_unmount(mp);
-
-       xfs_flush_buftarg(mp->m_ddev_targp, 1);
-
        xfs_unmountfs(mp);
+       xfs_syncd_stop(mp);
        xfs_freesb(mp);
        xfs_icsb_destroy_counters(mp);
        xfs_destroy_mount_workqueues(mp);
@@ -1072,7 +1069,7 @@ xfs_fs_statfs(
 
        spin_unlock(&mp->m_sb_lock);
 
-       if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) ||
+       if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
            ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))) ==
                              (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
                xfs_qm_statvfs(ip, statp);
@@ -1362,31 +1359,32 @@ xfs_fs_fill_super(
        sb->s_time_gran = 1;
        set_posix_acl_flag(sb);
 
-       error = xfs_mountfs(mp);
+       error = xfs_syncd_init(mp);
        if (error)
                goto out_filestream_unmount;
 
-       error = xfs_syncd_init(mp);
+       error = xfs_mountfs(mp);
        if (error)
-               goto out_unmount;
+               goto out_syncd_stop;
 
        root = igrab(VFS_I(mp->m_rootip));
        if (!root) {
                error = ENOENT;
-               goto out_syncd_stop;
+               goto out_unmount;
        }
        if (is_bad_inode(root)) {
                error = EINVAL;
-               goto out_syncd_stop;
+               goto out_unmount;
        }
        sb->s_root = d_make_root(root);
        if (!sb->s_root) {
                error = ENOMEM;
-               goto out_syncd_stop;
+               goto out_unmount;
        }
 
        return 0;
-
+ out_syncd_stop:
+       xfs_syncd_stop(mp);
  out_filestream_unmount:
        xfs_filestream_unmount(mp);
  out_free_sb:
@@ -1403,19 +1401,10 @@ out_destroy_workqueues:
  out:
        return -error;
 
- 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
-        * here.
-        */
        xfs_filestream_unmount(mp);
-
-       xfs_flush_buftarg(mp->m_ddev_targp, 1);
-
        xfs_unmountfs(mp);
+       xfs_syncd_stop(mp);
        goto out_free_sb;
 }