Merge tag 'staging-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-2.6-microblaze.git] / fs / xfs / xfs_super.c
index 11ea5d5..fd6be45 100644 (file)
@@ -46,6 +46,7 @@
 #include "xfs_quota.h"
 #include "xfs_sysfs.h"
 #include "xfs_ondisk.h"
+#include "xfs_rmap_item.h"
 
 #include <linux/namei.h>
 #include <linux/init.h>
@@ -546,7 +547,7 @@ xfs_showargs(
 
        return 0;
 }
-__uint64_t
+static __uint64_t
 xfs_max_file_offset(
        unsigned int            blockshift)
 {
@@ -1075,7 +1076,7 @@ xfs_fs_statfs(
        statp->f_blocks = sbp->sb_dblocks - lsize;
        spin_unlock(&mp->m_sb_lock);
 
-       statp->f_bfree = fdblocks - XFS_ALLOC_SET_ASIDE(mp);
+       statp->f_bfree = fdblocks - mp->m_alloc_set_aside;
        statp->f_bavail = statp->f_bfree;
 
        fakeinos = statp->f_bfree << sbp->sb_inopblog;
@@ -1294,6 +1295,7 @@ xfs_fs_remount(
                 */
                xfs_restore_resvblks(mp);
                xfs_log_work_queue(mp);
+               xfs_queue_eofblocks(mp);
        }
 
        /* rw -> ro */
@@ -1306,6 +1308,13 @@ xfs_fs_remount(
                 * return it to the same size.
                 */
                xfs_save_resvblks(mp);
+
+               /*
+                * Cancel background eofb scanning so it cannot race with the
+                * final log force+buftarg wait and deadlock the remount.
+                */
+               cancel_delayed_work_sync(&mp->m_eofblocks_work);
+
                xfs_quiesce_attr(mp);
                mp->m_flags |= XFS_MOUNT_RDONLY;
        }
@@ -1565,9 +1574,16 @@ xfs_fs_fill_super(
                }
        }
 
-       if (xfs_sb_version_hassparseinodes(&mp->m_sb))
+       if (xfs_sb_version_hasrmapbt(&mp->m_sb)) {
+               if (mp->m_sb.sb_rblocks) {
+                       xfs_alert(mp,
+       "EXPERIMENTAL reverse mapping btree not compatible with realtime device!");
+                       error = -EINVAL;
+                       goto out_filestream_unmount;
+               }
                xfs_alert(mp,
-       "EXPERIMENTAL sparse inode feature enabled. Use at your own risk!");
+       "EXPERIMENTAL reverse mapping btree feature enabled. Use at your own risk!");
+       }
 
        error = xfs_mountfs(mp);
        if (error)
@@ -1692,8 +1708,9 @@ xfs_init_zones(void)
        if (!xfs_log_ticket_zone)
                goto out_free_ioend_bioset;
 
-       xfs_bmap_free_item_zone = kmem_zone_init(sizeof(xfs_bmap_free_item_t),
-                                               "xfs_bmap_free_item");
+       xfs_bmap_free_item_zone = kmem_zone_init(
+                       sizeof(struct xfs_extent_free_item),
+                       "xfs_bmap_free_item");
        if (!xfs_bmap_free_item_zone)
                goto out_destroy_log_ticket_zone;
 
@@ -1760,8 +1777,24 @@ xfs_init_zones(void)
        if (!xfs_icreate_zone)
                goto out_destroy_ili_zone;
 
+       xfs_rud_zone = kmem_zone_init(sizeof(struct xfs_rud_log_item),
+                       "xfs_rud_item");
+       if (!xfs_rud_zone)
+               goto out_destroy_icreate_zone;
+
+       xfs_rui_zone = kmem_zone_init((sizeof(struct xfs_rui_log_item) +
+                       ((XFS_RUI_MAX_FAST_EXTENTS - 1) *
+                               sizeof(struct xfs_map_extent))),
+                       "xfs_rui_item");
+       if (!xfs_rui_zone)
+               goto out_destroy_rud_zone;
+
        return 0;
 
+ out_destroy_rud_zone:
+       kmem_zone_destroy(xfs_rud_zone);
+ out_destroy_icreate_zone:
+       kmem_zone_destroy(xfs_icreate_zone);
  out_destroy_ili_zone:
        kmem_zone_destroy(xfs_ili_zone);
  out_destroy_inode_zone:
@@ -1800,6 +1833,8 @@ xfs_destroy_zones(void)
         * destroy caches.
         */
        rcu_barrier();
+       kmem_zone_destroy(xfs_rui_zone);
+       kmem_zone_destroy(xfs_rud_zone);
        kmem_zone_destroy(xfs_icreate_zone);
        kmem_zone_destroy(xfs_ili_zone);
        kmem_zone_destroy(xfs_inode_zone);
@@ -1849,6 +1884,9 @@ init_xfs_fs(void)
        printk(KERN_INFO XFS_VERSION_STRING " with "
                         XFS_BUILD_OPTIONS " enabled\n");
 
+       xfs_extent_free_init_defer_op();
+       xfs_rmap_update_init_defer_op();
+
        xfs_dir_startup();
 
        error = xfs_init_zones();