]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/linux-2.6/xfs_super.c
filesystem freeze: add error handling of write_super_lockfs/unlockfs
[linux-2.6-omap-h63xx.git] / fs / xfs / linux-2.6 / xfs_super.c
index c3d004bc4621c7bf0b66580d5955386294879a79..95a971080368d3ab0136b66bdef1e5f37f8dfc86 100644 (file)
@@ -48,7 +48,6 @@
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
 #include "xfs_vnodeops.h"
-#include "xfs_vfsops.h"
 #include "xfs_version.h"
 #include "xfs_log_priv.h"
 #include "xfs_trans_priv.h"
@@ -990,21 +989,26 @@ xfs_fs_write_inode(
        struct inode            *inode,
        int                     sync)
 {
+       struct xfs_inode        *ip = XFS_I(inode);
        int                     error = 0;
        int                     flags = 0;
 
-       xfs_itrace_entry(XFS_I(inode));
+       xfs_itrace_entry(ip);
        if (sync) {
-               filemap_fdatawait(inode->i_mapping);
+               error = xfs_wait_on_pages(ip, 0, -1);
+               if (error)
+                       goto out_error;
                flags |= FLUSH_SYNC;
        }
-       error = xfs_inode_flush(XFS_I(inode), flags);
+       error = xfs_inode_flush(ip, flags);
+
+out_error:
        /*
         * if we failed to write out the inode then mark
         * it dirty again so we'll try again later.
         */
        if (error)
-               xfs_mark_inode_dirty_sync(XFS_I(inode));
+               xfs_mark_inode_dirty_sync(ip);
 
        return -error;
 }
@@ -1021,7 +1025,6 @@ xfs_fs_clear_inode(
        XFS_STATS_DEC(vn_active);
 
        xfs_inactive(ip);
-       xfs_iflags_clear(ip, XFS_IMODIFIED);
 }
 
 STATIC void
@@ -1040,7 +1043,6 @@ xfs_fs_put_super(
        struct xfs_mount        *mp = XFS_M(sb);
        struct xfs_inode        *rip = mp->m_rootip;
        int                     unmount_event_flags = 0;
-       int                     error;
 
        xfs_syncd_stop(mp);
        xfs_sync_inodes(mp, SYNC_ATTR|SYNC_DELWRI);
@@ -1068,8 +1070,6 @@ xfs_fs_put_super(
        xfs_filestream_unmount(mp);
 
        XFS_bflush(mp->m_ddev_targp);
-       error = xfs_unmount_flush(mp, 0);
-       WARN_ON(error);
 
        if (mp->m_flags & XFS_MOUNT_DMAPI) {
                XFS_SEND_UNMOUNT(mp, rip, DM_RIGHT_NULL, 0, 0,
@@ -1269,14 +1269,14 @@ xfs_fs_remount(
  * 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.
  */
-STATIC void
-xfs_fs_lockfs(
+STATIC int
+xfs_fs_freeze(
        struct super_block      *sb)
 {
        struct xfs_mount        *mp = XFS_M(sb);
 
        xfs_quiesce_attr(mp);
-       xfs_fs_log_dummy(mp);
+       return -xfs_fs_log_dummy(mp);
 }
 
 STATIC int
@@ -1348,7 +1348,7 @@ xfs_finish_flags(
 {
        int                     ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
 
-       /* Fail a mount where the logbuf is smaller then the log stripe */
+       /* Fail a mount where the logbuf is smaller than the log stripe */
        if (xfs_sb_version_haslogv2(&mp->m_sb)) {
                if (mp->m_logbsize <= 0 &&
                    mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) {
@@ -1385,35 +1385,6 @@ xfs_finish_flags(
                return XFS_ERROR(EROFS);
        }
 
-#if 0 /* shared mounts were never supported on Linux */
-       /*
-        * check for shared mount.
-        */
-       if (ap->flags & XFSMNT_SHARED) {
-               if (!xfs_sb_version_hasshared(&mp->m_sb))
-                       return XFS_ERROR(EINVAL);
-
-               /*
-                * For IRIX 6.5, shared mounts must have the shared
-                * version bit set, have the persistent readonly
-                * field set, must be version 0 and can only be mounted
-                * read-only.
-                */
-               if (!ronly || !(mp->m_sb.sb_flags & XFS_SBF_READONLY) ||
-                    (mp->m_sb.sb_shared_vn != 0))
-                       return XFS_ERROR(EINVAL);
-
-               mp->m_flags |= XFS_MOUNT_SHARED;
-
-               /*
-                * Shared XFS V0 can't deal with DMI.  Return EINVAL.
-                */
-               if (mp->m_sb.sb_shared_vn == 0 &&
-                   (mp->m_flags & XFS_MOUNT_DMAPI))
-                       return XFS_ERROR(EINVAL);
-       }
-#endif
-
        return 0;
 }
 
@@ -1561,8 +1532,6 @@ xfs_fs_fill_super(
        xfs_filestream_unmount(mp);
 
        XFS_bflush(mp->m_ddev_targp);
-       error = xfs_unmount_flush(mp, 0);
-       WARN_ON(error);
 
        xfs_unmountfs(mp);
        goto out_free_sb;
@@ -1588,7 +1557,7 @@ static struct super_operations xfs_super_operations = {
        .put_super              = xfs_fs_put_super,
        .write_super            = xfs_fs_write_super,
        .sync_fs                = xfs_fs_sync_super,
-       .write_super_lockfs     = xfs_fs_lockfs,
+       .freeze_fs              = xfs_fs_freeze,
        .statfs                 = xfs_fs_statfs,
        .remount_fs             = xfs_fs_remount,
        .show_options           = xfs_fs_show_options,
@@ -1848,13 +1817,12 @@ STATIC int __init
 init_xfs_fs(void)
 {
        int                     error;
-       static char             message[] __initdata = KERN_INFO \
-               XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
 
-       printk(message);
+       printk(KERN_INFO XFS_VERSION_STRING " with "
+                        XFS_BUILD_OPTIONS " enabled\n");
 
        ktrace_init(64);
-       vn_init();
+       xfs_ioend_init();
        xfs_dir_startup();
 
        error = xfs_init_zones();