]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/xfs/linux-2.6/xfs_super.c
[XFS] kill the vfs_flags member in struct bhv_vfs
[mirror_ubuntu-bionic-kernel.git] / fs / xfs / linux-2.6 / xfs_super.c
index 4528f9a3f304d5e923fa09458bd6aacfd04161c2..e275b7a82bc14665010ddce8450a29cf9f669ef8 100644 (file)
@@ -46,6 +46,8 @@
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
+#include "xfs_vnodeops.h"
+#include "xfs_vfsops.h"
 #include "xfs_version.h"
 
 #include <linux/namei.h>
@@ -196,23 +198,20 @@ xfs_revalidate_inode(
                inode->i_flags |= S_NOATIME;
        else
                inode->i_flags &= ~S_NOATIME;
-       vp->v_flag &= ~VMODIFIED;
+       xfs_iflags_clear(ip, XFS_IMODIFIED);
 }
 
 void
 xfs_initialize_vnode(
-       bhv_desc_t              *bdp,
+       struct xfs_mount        *mp,
        bhv_vnode_t             *vp,
-       bhv_desc_t              *inode_bhv,
-       int                     unlock)
+       struct xfs_inode        *ip)
 {
-       xfs_inode_t             *ip = XFS_BHVTOI(inode_bhv);
        struct inode            *inode = vn_to_inode(vp);
 
-       if (!inode_bhv->bd_vobj) {
-               vp->v_vfsp = bhvtovfs(bdp);
-               bhv_desc_init(inode_bhv, ip, vp, &xfs_vnodeops);
-               bhv_insert(VN_BHV_HEAD(vp), inode_bhv);
+       if (!ip->i_vnode) {
+               ip->i_vnode = vp;
+               inode->i_private = ip;
        }
 
        /*
@@ -222,8 +221,8 @@ xfs_initialize_vnode(
         * second time once the inode is properly set up, and then we can
         * finish our work.
         */
-       if (ip->i_d.di_mode != 0 && unlock && (inode->i_state & I_NEW)) {
-               xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip);
+       if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) {
+               xfs_revalidate_inode(mp, vp, ip);
                xfs_set_inodeops(inode);
 
                xfs_iflags_clear(ip, XFS_INEW);
@@ -304,14 +303,6 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
                return;
        }
 
-       if (mp->m_ddev_targp->bt_bdev->bd_disk->queue->ordered ==
-                                       QUEUE_ORDERED_NONE) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
-                 "Disabling barriers, not supported by the underlying device");
-               mp->m_flags &= ~XFS_MOUNT_BARRIER;
-               return;
-       }
-
        if (xfs_readonly_buftarg(mp->m_ddev_targp)) {
                xfs_fs_cmn_err(CE_NOTE, mp,
                  "Disabling barriers, underlying device is readonly");
@@ -410,17 +401,23 @@ xfs_fs_write_inode(
        struct inode            *inode,
        int                     sync)
 {
-       bhv_vnode_t             *vp = vn_from_inode(inode);
        int                     error = 0, flags = FLUSH_INODE;
 
-       if (vp) {
-               vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(XFS_I(inode), __FUNCTION__,
+                       (inst_t *)__return_address);
+       if (sync) {
+               filemap_fdatawait(inode->i_mapping);
+               flags |= FLUSH_SYNC;
+       }
+       error = xfs_inode_flush(XFS_I(inode), flags);
+       if (error == EAGAIN) {
                if (sync)
-                       flags |= FLUSH_SYNC;
-               error = bhv_vop_iflush(vp, flags);
-               if (error == EAGAIN)
-                       error = sync? bhv_vop_iflush(vp, flags | FLUSH_LOG) : 0;
+                       error = xfs_inode_flush(XFS_I(inode),
+                                                      flags | FLUSH_LOG);
+               else
+                       error = 0;
        }
+
        return -error;
 }
 
@@ -428,35 +425,27 @@ STATIC void
 xfs_fs_clear_inode(
        struct inode            *inode)
 {
-       bhv_vnode_t             *vp = vn_from_inode(inode);
-
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
-
-       XFS_STATS_INC(vn_rele);
-       XFS_STATS_INC(vn_remove);
-       XFS_STATS_INC(vn_reclaim);
-       XFS_STATS_DEC(vn_active);
+       xfs_inode_t             *ip = XFS_I(inode);
 
        /*
-        * This can happen because xfs_iget_core calls xfs_idestroy if we
+        * ip can be null when xfs_iget_core calls xfs_idestroy if we
         * find an inode with di_mode == 0 but without IGET_CREATE set.
         */
-       if (VNHEAD(vp))
-               bhv_vop_inactive(vp, NULL);
-
-       VN_LOCK(vp);
-       vp->v_flag &= ~VMODIFIED;
-       VN_UNLOCK(vp, 0);
-
-       if (VNHEAD(vp))
-               if (bhv_vop_reclaim(vp))
-                       panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp);
-
-       ASSERT(VNHEAD(vp) == NULL);
+       if (ip) {
+               vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
+
+               XFS_STATS_INC(vn_rele);
+               XFS_STATS_INC(vn_remove);
+               XFS_STATS_INC(vn_reclaim);
+               XFS_STATS_DEC(vn_active);
+
+               xfs_inactive(ip);
+               xfs_iflags_clear(ip, XFS_IMODIFIED);
+               if (xfs_reclaim(ip))
+                       panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, inode);
+       }
 
-#ifdef XFS_VNODE_TRACE
-       ktrace_free(vp->v_trace);
-#endif
+       ASSERT(XFS_I(inode) == NULL);
 }
 
 /*
@@ -545,10 +534,9 @@ vfs_sync_worker(
 {
        int             error;
 
-       if (!(vfsp->vfs_flag & VFS_RDONLY))
-               error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \
-                                       SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER,
-                                       NULL);
+       if (!(XFS_VFSTOM(vfsp)->m_flags & XFS_MOUNT_RDONLY))
+               error = xfs_sync(XFS_VFSTOM(vfsp), SYNC_FSDATA | SYNC_BDFLUSH | \
+                                       SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER);
        vfsp->vfs_sync_seq++;
        wake_up(&vfsp->vfs_wait_single_sync_task);
 }
@@ -625,11 +613,12 @@ xfs_fs_put_super(
        struct super_block      *sb)
 {
        bhv_vfs_t               *vfsp = vfs_from_sb(sb);
+       struct xfs_mount        *mp = XFS_M(sb);
        int                     error;
 
        xfs_fs_stop_syncd(vfsp);
-       bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL);
-       error = bhv_vfs_unmount(vfsp, 0, NULL);
+       xfs_sync(mp, SYNC_ATTR | SYNC_DELWRI);
+       error = xfs_unmount(mp, 0, NULL);
        if (error) {
                printk("XFS: unmount got error=%d\n", error);
                printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp);
@@ -643,7 +632,7 @@ xfs_fs_write_super(
        struct super_block      *sb)
 {
        if (!(sb->s_flags & MS_RDONLY))
-               bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL);
+               xfs_sync(XFS_M(sb), SYNC_FSDATA);
        sb->s_dirt = 0;
 }
 
@@ -653,6 +642,7 @@ xfs_fs_sync_super(
        int                     wait)
 {
        bhv_vfs_t               *vfsp = vfs_from_sb(sb);
+       struct xfs_mount        *mp = XFS_M(sb);
        int                     error;
        int                     flags;
 
@@ -669,7 +659,7 @@ xfs_fs_sync_super(
        } else
                flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
 
-       error = bhv_vfs_sync(vfsp, flags, NULL);
+       error = xfs_sync(mp, flags);
        sb->s_dirt = 0;
 
        if (unlikely(laptop_mode)) {
@@ -699,7 +689,7 @@ xfs_fs_statfs(
        struct dentry           *dentry,
        struct kstatfs          *statp)
 {
-       return -bhv_vfs_statvfs(vfs_from_sb(dentry->d_sb), statp,
+       return -xfs_statvfs(XFS_M(dentry->d_sb), statp,
                                vn_from_inode(dentry->d_inode));
 }
 
@@ -709,13 +699,13 @@ xfs_fs_remount(
        int                     *flags,
        char                    *options)
 {
-       bhv_vfs_t               *vfsp = vfs_from_sb(sb);
+       struct xfs_mount        *mp = XFS_M(sb);
        struct xfs_mount_args   *args = xfs_args_allocate(sb, 0);
        int                     error;
 
-       error = bhv_vfs_parseargs(vfsp, options, args, 1);
+       error = xfs_parseargs(mp, options, args, 1);
        if (!error)
-               error = bhv_vfs_mntupdate(vfsp, flags, args);
+               error = xfs_mntupdate(mp, flags, args);
        kmem_free(args, sizeof(*args));
        return -error;
 }
@@ -724,7 +714,7 @@ STATIC void
 xfs_fs_lockfs(
        struct super_block      *sb)
 {
-       bhv_vfs_freeze(vfs_from_sb(sb));
+       xfs_freeze(XFS_M(sb));
 }
 
 STATIC int
@@ -732,7 +722,7 @@ xfs_fs_show_options(
        struct seq_file         *m,
        struct vfsmount         *mnt)
 {
-       return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m);
+       return -xfs_showargs(XFS_M(mnt->mnt_sb), m);
 }
 
 STATIC int
@@ -740,7 +730,7 @@ xfs_fs_quotasync(
        struct super_block      *sb,
        int                     type)
 {
-       return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL);
+       return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
 }
 
 STATIC int
@@ -748,7 +738,7 @@ xfs_fs_getxstate(
        struct super_block      *sb,
        struct fs_quota_stat    *fqs)
 {
-       return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
+       return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
 }
 
 STATIC int
@@ -757,7 +747,7 @@ xfs_fs_setxstate(
        unsigned int            flags,
        int                     op)
 {
-       return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags);
+       return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
 }
 
 STATIC int
@@ -767,7 +757,7 @@ xfs_fs_getxquota(
        qid_t                   id,
        struct fs_disk_quota    *fdq)
 {
-       return -bhv_vfs_quotactl(vfs_from_sb(sb),
+       return -XFS_QM_QUOTACTL(XFS_M(sb),
                                 (type == USRQUOTA) ? Q_XGETQUOTA :
                                  ((type == GRPQUOTA) ? Q_XGETGQUOTA :
                                   Q_XGETPQUOTA), id, (caddr_t)fdq);
@@ -780,7 +770,7 @@ xfs_fs_setxquota(
        qid_t                   id,
        struct fs_disk_quota    *fdq)
 {
-       return -bhv_vfs_quotactl(vfs_from_sb(sb),
+       return -XFS_QM_QUOTACTL(XFS_M(sb),
                                 (type == USRQUOTA) ? Q_XSETQLIM :
                                  ((type == GRPQUOTA) ? Q_XSETGQLIM :
                                   Q_XSETPQLIM), id, (caddr_t)fdq);
@@ -792,32 +782,34 @@ xfs_fs_fill_super(
        void                    *data,
        int                     silent)
 {
-       struct bhv_vnode        *rootvp;
+       struct inode            *rootvp;
        struct bhv_vfs          *vfsp = vfs_allocate(sb);
+       struct xfs_mount        *mp = NULL;
        struct xfs_mount_args   *args = xfs_args_allocate(sb, silent);
        struct kstatfs          statvfs;
        int                     error;
 
-       bhv_insert_all_vfsops(vfsp);
+       mp = xfs_mount_init();
+       mp->m_vfsp = vfsp;
+       vfsp->vfs_mount = mp;
 
-       error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0);
-       if (error) {
-               bhv_remove_all_vfsops(vfsp, 1);
+       if (sb->s_flags & MS_RDONLY)
+               mp->m_flags |= XFS_MOUNT_RDONLY;
+
+       error = xfs_parseargs(mp, (char *)data, args, 0);
+       if (error)
                goto fail_vfsop;
-       }
 
        sb_min_blocksize(sb, BBSIZE);
        sb->s_export_op = &xfs_export_operations;
        sb->s_qcop = &xfs_quotactl_operations;
        sb->s_op = &xfs_super_operations;
 
-       error = bhv_vfs_mount(vfsp, args, NULL);
-       if (error) {
-               bhv_remove_all_vfsops(vfsp, 1);
+       error = xfs_mount(mp, args, NULL);
+       if (error)
                goto fail_vfsop;
-       }
 
-       error = bhv_vfs_statvfs(vfsp, &statvfs, NULL);
+       error = xfs_statvfs(mp, &statvfs, NULL);
        if (error)
                goto fail_unmount;
 
@@ -829,7 +821,7 @@ xfs_fs_fill_super(
        sb->s_time_gran = 1;
        set_posix_acl_flag(sb);
 
-       error = bhv_vfs_root(vfsp, &rootvp);
+       error = xfs_root(mp, &rootvp);
        if (error)
                goto fail_unmount;
 
@@ -844,7 +836,8 @@ xfs_fs_fill_super(
        }
        if ((error = xfs_fs_start_syncd(vfsp)))
                goto fail_vnrele;
-       vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_exit(XFS_I(sb->s_root->d_inode), __FUNCTION__,
+                       (inst_t *)__return_address);
 
        kmem_free(args, sizeof(*args));
        return 0;
@@ -858,7 +851,7 @@ fail_vnrele:
        }
 
 fail_unmount:
-       bhv_vfs_unmount(vfsp, 0, NULL);
+       xfs_unmount(mp, 0, NULL);
 
 fail_vfsop:
        vfs_deallocate(vfsp);
@@ -913,15 +906,11 @@ STATIC int __init
 init_xfs_fs( void )
 {
        int                     error;
-       struct sysinfo          si;
        static char             message[] __initdata = KERN_INFO \
                XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
 
        printk(message);
 
-       si_meminfo(&si);
-       xfs_physmem = si.totalram;
-
        ktrace_init(64);
 
        error = xfs_init_zones();