Merge branch 'akpm' (patches from Andrew)
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_super.c
index 19cbda196369021cf48fb1f7cab29b866d4ba16c..8fcc4ccc5c791224e0d9325a5ad0557390a14d71 100644 (file)
@@ -685,7 +685,7 @@ xfs_blkdev_get(
                                    mp);
        if (IS_ERR(*bdevp)) {
                error = PTR_ERR(*bdevp);
-               xfs_warn(mp, "Invalid device [%s], error=%d\n", name, error);
+               xfs_warn(mp, "Invalid device [%s], error=%d", name, error);
        }
 
        return error;
@@ -1111,6 +1111,11 @@ xfs_fs_statfs(
                                        statp->f_files,
                                        mp->m_maxicount);
 
+       /* If sb_icount overshot maxicount, report actual allocation */
+       statp->f_files = max_t(typeof(statp->f_files),
+                                       statp->f_files,
+                                       sbp->sb_icount);
+
        /* make sure statp->f_ffree does not underflow */
        ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
        statp->f_ffree = max_t(__int64_t, ffree, 0);
@@ -1257,13 +1262,13 @@ xfs_fs_remount(
                 * If this is the first remount to writeable state we
                 * might have some superblock changes to update.
                 */
-               if (mp->m_update_flags) {
-                       error = xfs_mount_log_sb(mp, mp->m_update_flags);
+               if (mp->m_update_sb) {
+                       error = xfs_sync_sb(mp, false);
                        if (error) {
                                xfs_warn(mp, "failed to write sb changes");
                                return error;
                        }
-                       mp->m_update_flags = 0;
+                       mp->m_update_sb = false;
                }
 
                /*
@@ -1293,8 +1298,9 @@ xfs_fs_remount(
 
 /*
  * Second stage of a freeze. The data is already frozen so we only
- * need to take care of the metadata. Once that's done write a dummy
- * record to dirty the log in case of a crash while frozen.
+ * need to take care of the metadata. Once that's done sync the superblock
+ * to the log to dirty it in case of a crash while frozen. This ensures that we
+ * will recover the unlinked inode lists on the next mount.
  */
 STATIC int
 xfs_fs_freeze(
@@ -1304,7 +1310,7 @@ xfs_fs_freeze(
 
        xfs_save_resvblks(mp);
        xfs_quiesce_attr(mp);
-       return xfs_fs_log_dummy(mp);
+       return xfs_sync_sb(mp, true);
 }
 
 STATIC int
@@ -1531,7 +1537,7 @@ xfs_fs_mount(
 static long
 xfs_fs_nr_cached_objects(
        struct super_block      *sb,
-       int                     nid)
+       struct shrink_control   *sc)
 {
        return xfs_reclaim_inodes_count(XFS_M(sb));
 }
@@ -1539,10 +1545,9 @@ xfs_fs_nr_cached_objects(
 static long
 xfs_fs_free_cached_objects(
        struct super_block      *sb,
-       long                    nr_to_scan,
-       int                     nid)
+       struct shrink_control   *sc)
 {
-       return xfs_reclaim_inodes_nr(XFS_M(sb), nr_to_scan);
+       return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan);
 }
 
 static const struct super_operations xfs_super_operations = {