]> err.no Git - linux-2.6/blobdiff - fs/xfs/xfs_vfsops.c
[CIFS] Remove compiler warning
[linux-2.6] / fs / xfs / xfs_vfsops.c
index 9ea201762a9c2bc9c1843dcc7407fab22e118674..b6ad370fab3d839d7ff792ca9c03a33bf17a8b3f 100644 (file)
@@ -1,33 +1,19 @@
 /*
- * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
 #include "xfs_fs.h"
@@ -67,6 +53,7 @@
 #include "xfs_acl.h"
 #include "xfs_attr.h"
 #include "xfs_clnt.h"
+#include "xfs_fsops.h"
 
 STATIC int xfs_sync(bhv_desc_t *, int, cred_t *);
 
@@ -228,9 +215,7 @@ xfs_start_flags(
        }
 
        if (ap->logbufs != -1 &&
-#if defined(DEBUG) || defined(XLOG_NOLOG)
            ap->logbufs != 0 &&
-#endif
            (ap->logbufs < XLOG_MIN_ICLOGS ||
             ap->logbufs > XLOG_MAX_ICLOGS)) {
                cmn_err(CE_WARN,
@@ -240,6 +225,7 @@ xfs_start_flags(
        }
        mp->m_logbufs = ap->logbufs;
        if (ap->logbufsize != -1 &&
+           ap->logbufsize !=  0 &&
            ap->logbufsize != 16 * 1024 &&
            ap->logbufsize != 32 * 1024 &&
            ap->logbufsize != 64 * 1024 &&
@@ -283,7 +269,7 @@ xfs_start_flags(
        if (ap->flags & XFSMNT_OSYNCISOSYNC)
                mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC;
        if (ap->flags & XFSMNT_32BITINODES)
-               mp->m_flags |= (XFS_MOUNT_32BITINODES | XFS_MOUNT_32BITINOOPT);
+               mp->m_flags |= XFS_MOUNT_32BITINODES;
 
        if (ap->flags & XFSMNT_IOSIZE) {
                if (ap->iosizelog > XFS_MAX_IO_LOG ||
@@ -305,10 +291,11 @@ xfs_start_flags(
                mp->m_flags |= XFS_MOUNT_IDELETE;
        if (ap->flags & XFSMNT_DIRSYNC)
                mp->m_flags |= XFS_MOUNT_DIRSYNC;
-       if (ap->flags & XFSMNT_COMPAT_IOSIZE)
+       if (ap->flags & XFSMNT_ATTR2)
+               mp->m_flags |= XFS_MOUNT_ATTR2;
+
+       if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE)
                mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
-       if (ap->flags & XFSMNT_COMPAT_ATTR)
-               mp->m_flags |= XFS_MOUNT_COMPAT_ATTR;
 
        /*
         * no recovery flag requires a read-only mount
@@ -326,6 +313,8 @@ xfs_start_flags(
                mp->m_flags |= XFS_MOUNT_NOUUID;
        if (ap->flags & XFSMNT_BARRIER)
                mp->m_flags |= XFS_MOUNT_BARRIER;
+       else
+               mp->m_flags &= ~XFS_MOUNT_BARRIER;
 
        return 0;
 }
@@ -344,10 +333,11 @@ xfs_finish_flags(
 
        /* Fail a mount where the logbuf is smaller then the log stripe */
        if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) {
-               if ((ap->logbufsize == -1) &&
+               if ((ap->logbufsize <= 0) &&
                    (mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE)) {
                        mp->m_logbsize = mp->m_sb.sb_logsunit;
-               } else if (ap->logbufsize < mp->m_sb.sb_logsunit) {
+               } else if (ap->logbufsize > 0 &&
+                          ap->logbufsize < mp->m_sb.sb_logsunit) {
                        cmn_err(CE_WARN,
        "XFS: logbuf size must be greater than or equal to log stripe size");
                        return XFS_ERROR(EINVAL);
@@ -361,6 +351,10 @@ xfs_finish_flags(
                }
        }
 
+       if (XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
+               mp->m_flags |= XFS_MOUNT_ATTR2;
+       }
+
        /*
         * prohibit r/w mounts of read-only filesystems
         */
@@ -514,13 +508,13 @@ xfs_mount(
        if (error)
                goto error2;
 
+       if ((mp->m_flags & XFS_MOUNT_BARRIER) && !(vfsp->vfs_flag & VFS_RDONLY))
+               xfs_mountfs_check_barriers(mp);
+
        error = XFS_IOINIT(vfsp, args, flags);
        if (error)
                goto error2;
 
-       if ((args->flags & XFSMNT_BARRIER) &&
-           !(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY))
-               xfs_mountfs_check_barriers(mp);
        return 0;
 
 error2:
@@ -665,6 +659,11 @@ xfs_mntupdate(
        else
                mp->m_flags &= ~XFS_MOUNT_NOATIME;
 
+       if (args->flags & XFSMNT_BARRIER)
+               mp->m_flags |= XFS_MOUNT_BARRIER;
+       else
+               mp->m_flags &= ~XFS_MOUNT_BARRIER;
+
        if ((vfsp->vfs_flag & VFS_RDONLY) &&
            !(*flags & MS_RDONLY)) {
                vfsp->vfs_flag &= ~VFS_RDONLY;
@@ -1644,6 +1643,7 @@ xfs_vget(
 #define MNTOPT_NORECOVERY   "norecovery"   /* don't run XFS recovery */
 #define MNTOPT_BARRIER "barrier"       /* use writer barriers for log write and
                                         * unwritten extent conversion */
+#define MNTOPT_NOBARRIER "nobarrier"   /* .. disable */
 #define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */
 #define MNTOPT_64BITINODE   "inode64"  /* inodes can be allocated anywhere */
 #define MNTOPT_IKEEP   "ikeep"         /* do not free empty inode clusters */
@@ -1689,13 +1689,14 @@ xfs_parseargs(
        int                     dsunit, dswidth, vol_dsunit, vol_dswidth;
        int                     iosize;
 
-       args->flags |= XFSMNT_COMPAT_IOSIZE;
+       args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
+
 #if 0  /* XXX: off by default, until some remaining issues ironed out */
        args->flags |= XFSMNT_IDELETE; /* default to on */
 #endif
 
        if (!options)
-               return 0;
+               goto done;
 
        iosize = dsunit = dswidth = vol_dsunit = vol_dswidth = 0;
 
@@ -1814,18 +1815,20 @@ xfs_parseargs(
                        args->flags |= XFSMNT_NOUUID;
                } else if (!strcmp(this_char, MNTOPT_BARRIER)) {
                        args->flags |= XFSMNT_BARRIER;
+               } else if (!strcmp(this_char, MNTOPT_NOBARRIER)) {
+                       args->flags &= ~XFSMNT_BARRIER;
                } else if (!strcmp(this_char, MNTOPT_IKEEP)) {
                        args->flags &= ~XFSMNT_IDELETE;
                } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) {
                        args->flags |= XFSMNT_IDELETE;
                } else if (!strcmp(this_char, MNTOPT_LARGEIO)) {
-                       args->flags &= ~XFSMNT_COMPAT_IOSIZE;
+                       args->flags2 &= ~XFSMNT2_COMPAT_IOSIZE;
                } else if (!strcmp(this_char, MNTOPT_NOLARGEIO)) {
-                       args->flags |= XFSMNT_COMPAT_IOSIZE;
+                       args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
                } else if (!strcmp(this_char, MNTOPT_ATTR2)) {
-                       args->flags &= ~XFSMNT_COMPAT_ATTR;
+                       args->flags |= XFSMNT_ATTR2;
                } else if (!strcmp(this_char, MNTOPT_NOATTR2)) {
-                       args->flags |= XFSMNT_COMPAT_ATTR;
+                       args->flags &= ~XFSMNT_ATTR2;
                } else if (!strcmp(this_char, "osyncisdsync")) {
                        /* no-op, this is now the default */
 printk("XFS: osyncisdsync is now the default, option is deprecated.\n");
@@ -1875,6 +1878,11 @@ printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n");
                args->sunit = args->swidth = 0;
        }
 
+done:
+       if (args->flags & XFSMNT_32BITINODES)
+               vfsp->vfs_flag |= VFS_32BITINODES;
+       if (args->flags2)
+               args->flags |= XFSMNT_FLAGS2;
        return 0;
 }
 
@@ -1895,7 +1903,6 @@ xfs_showargs(
                { XFS_MOUNT_NOUUID,             "," MNTOPT_NOUUID },
                { XFS_MOUNT_NORECOVERY,         "," MNTOPT_NORECOVERY },
                { XFS_MOUNT_OSYNCISOSYNC,       "," MNTOPT_OSYNCISOSYNC },
-               { XFS_MOUNT_BARRIER,            "," MNTOPT_BARRIER },
                { XFS_MOUNT_IDELETE,            "," MNTOPT_NOIKEEP },
                { 0, NULL }
        };
@@ -1912,31 +1919,33 @@ xfs_showargs(
                seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", mp->m_ihsize);
 
        if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
-               seq_printf(m, "," MNTOPT_ALLOCSIZE "=%d", 1<<mp->m_writeio_log);
+               seq_printf(m, "," MNTOPT_ALLOCSIZE "=%dk",
+                               (int)(1 << mp->m_writeio_log) >> 10);
 
        if (mp->m_logbufs > 0)
                seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs);
-
        if (mp->m_logbsize > 0)
-               seq_printf(m, "," MNTOPT_LOGBSIZE "=%d", mp->m_logbsize);
+               seq_printf(m, "," MNTOPT_LOGBSIZE "=%dk", mp->m_logbsize >> 10);
 
        if (mp->m_logname)
                seq_printf(m, "," MNTOPT_LOGDEV "=%s", mp->m_logname);
-
        if (mp->m_rtname)
                seq_printf(m, "," MNTOPT_RTDEV "=%s", mp->m_rtname);
 
        if (mp->m_dalign > 0)
                seq_printf(m, "," MNTOPT_SUNIT "=%d",
                                (int)XFS_FSB_TO_BB(mp, mp->m_dalign));
-
        if (mp->m_swidth > 0)
                seq_printf(m, "," MNTOPT_SWIDTH "=%d",
                                (int)XFS_FSB_TO_BB(mp, mp->m_swidth));
 
-       if (!(mp->m_flags & XFS_MOUNT_32BITINOOPT))
-               seq_printf(m, "," MNTOPT_64BITINODE);
+       if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE))
+               seq_printf(m, "," MNTOPT_LARGEIO);
+       if (mp->m_flags & XFS_MOUNT_BARRIER)
+               seq_printf(m, "," MNTOPT_BARRIER);
 
+       if (!(vfsp->vfs_flag & VFS_32BITINODES))
+               seq_printf(m, "," MNTOPT_64BITINODE);
        if (vfsp->vfs_flag & VFS_GRPID)
                seq_printf(m, "," MNTOPT_GRPID);
 
@@ -1955,6 +1964,7 @@ xfs_freeze(
        /* Push the superblock and write an unmount record */
        xfs_log_unmount_write(mp);
        xfs_unmountfs_writesb(mp);
+       xfs_fs_log_dummy(mp);
 }