fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / fs / xfs / linux-2.6 / xfs_vfs.c
index 855e914..6145e8b 100644 (file)
@@ -1,45 +1,28 @@
 /*
- * Copyright (c) 2000-2003 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"
-#include "xfs_macros.h"
 #include "xfs_inum.h"
 #include "xfs_log.h"
 #include "xfs_clnt.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_imap.h"
 #include "xfs_alloc.h"
@@ -120,7 +103,7 @@ vfs_mntupdate(
 int
 vfs_root(
        struct bhv_desc         *bdp,
-       struct vnode            **vpp)
+       struct bhv_vnode        **vpp)
 {
        struct bhv_desc         *next = bdp;
 
@@ -133,15 +116,15 @@ vfs_root(
 int
 vfs_statvfs(
        struct bhv_desc         *bdp,
-       xfs_statfs_t            *sp,
-       struct vnode            *vp)
+       bhv_statvfs_t           *statp,
+       struct bhv_vnode        *vp)
 {
        struct bhv_desc         *next = bdp;
 
        ASSERT(next);
        while (! (bhvtovfsops(next))->vfs_statvfs)
                next = BHV_NEXT(next);
-       return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp));
+       return ((*bhvtovfsops(next)->vfs_statvfs)(next, statp, vp));
 }
 
 int
@@ -161,7 +144,7 @@ vfs_sync(
 int
 vfs_vget(
        struct bhv_desc         *bdp,
-       struct vnode            **vpp,
+       struct bhv_vnode        **vpp,
        struct fid              *fidp)
 {
        struct bhv_desc         *next = bdp;
@@ -203,7 +186,7 @@ vfs_quotactl(
 void
 vfs_init_vnode(
        struct bhv_desc         *bdp,
-       struct vnode            *vp,
+       struct bhv_vnode        *vp,
        struct bhv_desc         *bp,
        int                     unlock)
 {
@@ -242,32 +225,46 @@ vfs_freeze(
        ((*bhvtovfsops(next)->vfs_freeze)(next));
 }
 
-vfs_t *
-vfs_allocate( void )
+bhv_vfs_t *
+vfs_allocate(
+       struct super_block      *sb)
 {
-       struct vfs              *vfsp;
+       struct bhv_vfs          *vfsp;
 
-       vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
+       vfsp = kmem_zalloc(sizeof(bhv_vfs_t), KM_SLEEP);
        bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
        INIT_LIST_HEAD(&vfsp->vfs_sync_list);
-       vfsp->vfs_sync_lock = SPIN_LOCK_UNLOCKED;
-       init_waitqueue_head(&vfsp->vfs_wait_sync_task);
+       spin_lock_init(&vfsp->vfs_sync_lock);
        init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
+
+       vfsp->vfs_super = sb;
+       sb->s_fs_info = vfsp;
+
+       if (sb->s_flags & MS_RDONLY)
+               vfsp->vfs_flag |= VFS_RDONLY;
+
        return vfsp;
 }
 
+bhv_vfs_t *
+vfs_from_sb(
+       struct super_block      *sb)
+{
+       return (bhv_vfs_t *)sb->s_fs_info;
+}
+
 void
 vfs_deallocate(
-       struct vfs              *vfsp)
+       struct bhv_vfs          *vfsp)
 {
        bhv_head_destroy(VFS_BHVHEAD(vfsp));
-       kmem_free(vfsp, sizeof(vfs_t));
+       kmem_free(vfsp, sizeof(bhv_vfs_t));
 }
 
 void
 vfs_insertops(
-       struct vfs              *vfsp,
-       struct bhv_vfsops       *vfsops)
+       struct bhv_vfs          *vfsp,
+       struct bhv_module_vfsops *vfsops)
 {
        struct bhv_desc         *bdp;
 
@@ -278,9 +275,9 @@ vfs_insertops(
 
 void
 vfs_insertbhv(
-       struct vfs              *vfsp,
+       struct bhv_vfs          *vfsp,
        struct bhv_desc         *bdp,
-       struct vfsops           *vfsops,
+       struct bhv_vfsops       *vfsops,
        void                    *mount)
 {
        bhv_desc_init(bdp, mount, vfsp, vfsops);
@@ -289,7 +286,7 @@ vfs_insertbhv(
 
 void
 bhv_remove_vfsops(
-       struct vfs              *vfsp,
+       struct bhv_vfs          *vfsp,
        int                     pos)
 {
        struct bhv_desc         *bhv;
@@ -303,7 +300,7 @@ bhv_remove_vfsops(
 
 void
 bhv_remove_all_vfsops(
-       struct vfs              *vfsp,
+       struct bhv_vfs          *vfsp,
        int                     freebase)
 {
        struct xfs_mount        *mp;
@@ -312,14 +309,14 @@ bhv_remove_all_vfsops(
        bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
        if (!freebase)
                return;
-       mp = XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfsp), &xfs_vfsops));
+       mp = XFS_VFSTOM(vfsp);
        VFS_REMOVEBHV(vfsp, &mp->m_bhv);
        xfs_mount_free(mp, 0);
 }
 
 void
 bhv_insert_all_vfsops(
-       struct vfs              *vfsp)
+       struct bhv_vfs          *vfsp)
 {
        struct xfs_mount        *mp;