[XFS] cleanup fid types mess
[sfrench/cifs-2.6.git] / fs / xfs / xfs_vnodeops.c
index 8ed7af3c5d63d3bdab304509641e2f32ecd10a65..efd5aff9eaf6aa1d149fa6431ca6355e944c5b1a 100644 (file)
@@ -88,7 +88,7 @@ xfs_getattr(
        bhv_vnode_t     *vp = XFS_ITOV(ip);
        xfs_mount_t     *mp = ip->i_mount;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -228,9 +228,9 @@ xfs_setattr(
        int                     file_owner;
        int                     need_iolock = 1;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
-       if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY)
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
                return XFS_ERROR(EROFS);
 
        /*
@@ -598,7 +598,7 @@ xfs_setattr(
                }
 
                /* wait for all I/O to complete */
-               vn_iowait(vp);
+               vn_iowait(ip);
 
                if (!code)
                        code = xfs_itruncate_data(ip, vap->va_size);
@@ -915,7 +915,7 @@ xfs_access(
 {
        int             error;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        xfs_ilock(ip, XFS_ILOCK_SHARED);
        error = xfs_iaccess(ip, mode, credp);
@@ -987,7 +987,7 @@ xfs_readlink(
        int             pathlen;
        int             error = 0;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -1033,7 +1033,7 @@ xfs_fsync(
        int             error;
        int             log_flushed = 0, changed = 1;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        ASSERT(start >= 0 && stop >= -1);
 
@@ -1515,7 +1515,7 @@ xfs_release(
                return 0;
 
        /* If this is a read-only mount, don't do this (would generate I/O) */
-       if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY)
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
                return 0;
 
        if (!XFS_FORCED_SHUTDOWN(mp)) {
@@ -1592,7 +1592,7 @@ xfs_inactive(
        int             error;
        int             truncate;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        /*
         * If the inode is already free, then there can be nothing
@@ -1624,7 +1624,7 @@ xfs_inactive(
        error = 0;
 
        /* If this is a read-only mount, don't do this (would generate I/O) */
-       if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY)
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
                goto out;
 
        if (ip->i_d.di_nlink != 0) {
@@ -1805,7 +1805,7 @@ xfs_lookup(
        int                     error;
        uint                    lock_mode;
 
-       vn_trace_entry(XFS_ITOV(dp), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
        if (XFS_FORCED_SHUTDOWN(dp->i_mount))
                return XFS_ERROR(EIO);
@@ -1824,7 +1824,8 @@ int
 xfs_create(
        xfs_inode_t             *dp,
        bhv_vname_t             *dentry,
-       bhv_vattr_t             *vap,
+       mode_t                  mode,
+       xfs_dev_t               rdev,
        bhv_vnode_t             **vpp,
        cred_t                  *credp)
 {
@@ -1834,7 +1835,6 @@ xfs_create(
        xfs_inode_t             *ip;
        bhv_vnode_t             *vp = NULL;
        xfs_trans_t             *tp;
-       xfs_dev_t               rdev;
        int                     error;
        xfs_bmap_free_t         free_list;
        xfs_fsblock_t           first_block;
@@ -1845,20 +1845,18 @@ xfs_create(
        xfs_prid_t              prid;
        struct xfs_dquot        *udqp, *gdqp;
        uint                    resblks;
-       int                     dm_di_mode;
        int                     namelen;
 
        ASSERT(!*vpp);
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
-       dm_di_mode = vap->va_mode;
        namelen = VNAMELEN(dentry);
 
        if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
                                dir_vp, DM_RIGHT_NULL, NULL,
                                DM_RIGHT_NULL, name, NULL,
-                               dm_di_mode, 0, 0);
+                               mode, 0, 0);
 
                if (error)
                        return error;
@@ -1873,8 +1871,6 @@ xfs_create(
        udqp = gdqp = NULL;
        if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
                prid = dp->i_d.di_projid;
-       else if (vap->va_mask & XFS_AT_PROJID)
-               prid = (xfs_prid_t)vap->va_projid;
        else
                prid = (xfs_prid_t)dfltprid;
 
@@ -1926,8 +1922,7 @@ xfs_create(
 
        if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen)))
                goto error_return;
-       rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0;
-       error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1,
+       error = xfs_dir_ialloc(&tp, dp, mode, 1,
                        rdev, credp, prid, resblks > 0,
                        &ip, &committed);
        if (error) {
@@ -2018,7 +2013,7 @@ std_return:
                        dir_vp, DM_RIGHT_NULL,
                        *vpp ? vp:NULL,
                        DM_RIGHT_NULL, name, NULL,
-                       dm_di_mode, error, 0);
+                       mode, error, 0);
        }
        return error;
 
@@ -2326,7 +2321,7 @@ xfs_remove(
        uint                    resblks;
        int                     namelen;
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -2369,7 +2364,7 @@ xfs_remove(
 
        dm_di_mode = ip->i_d.di_mode;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        ITRACE(ip);
 
@@ -2503,7 +2498,7 @@ xfs_remove(
        if (link_zero && xfs_inode_is_filestream(ip))
                xfs_filestream_deassociate(ip);
 
-       vn_trace_exit(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_exit(ip, __FUNCTION__, (inst_t *)__return_address);
 
        IRELE(ip);
 
@@ -2567,8 +2562,8 @@ xfs_link(
        char                    *target_name = VNAME(dentry);
        int                     target_namelen;
 
-       vn_trace_entry(target_dir_vp, __FUNCTION__, (inst_t *)__return_address);
-       vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(tdp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(xfs_vtoi(src_vp), __FUNCTION__, (inst_t *)__return_address);
 
        target_namelen = VNAMELEN(dentry);
        ASSERT(!VN_ISDIR(src_vp));
@@ -2709,7 +2704,7 @@ int
 xfs_mkdir(
        xfs_inode_t             *dp,
        bhv_vname_t             *dentry,
-       bhv_vattr_t             *vap,
+       mode_t                  mode,
        bhv_vnode_t             **vpp,
        cred_t                  *credp)
 {
@@ -2731,19 +2726,17 @@ xfs_mkdir(
        xfs_prid_t              prid;
        struct xfs_dquot        *udqp, *gdqp;
        uint                    resblks;
-       int                     dm_di_mode;
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
 
        tp = NULL;
-       dm_di_mode = vap->va_mode;
 
        if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
                                        dir_vp, DM_RIGHT_NULL, NULL,
                                        DM_RIGHT_NULL, dir_name, NULL,
-                                       dm_di_mode, 0, 0);
+                                       mode, 0, 0);
                if (error)
                        return error;
                dm_event_sent = 1;
@@ -2751,14 +2744,12 @@ xfs_mkdir(
 
        /* Return through std_return after this point. */
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
        mp = dp->i_mount;
        udqp = gdqp = NULL;
        if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
                prid = dp->i_d.di_projid;
-       else if (vap->va_mask & XFS_AT_PROJID)
-               prid = (xfs_prid_t)vap->va_projid;
        else
                prid = (xfs_prid_t)dfltprid;
 
@@ -2811,7 +2802,7 @@ xfs_mkdir(
        /*
         * create the directory inode.
         */
-       error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 2,
+       error = xfs_dir_ialloc(&tp, dp, mode, 2,
                        0, credp, prid, resblks > 0,
                &cdp, NULL);
        if (error) {
@@ -2905,7 +2896,7 @@ std_return:
                                        created ? XFS_ITOV(cdp):NULL,
                                        DM_RIGHT_NULL,
                                        dir_name, NULL,
-                                       dm_di_mode, error, 0);
+                                       mode, error, 0);
        }
        return error;
 
@@ -2945,7 +2936,7 @@ xfs_rmdir(
        int                     last_cdp_link;
        uint                    resblks;
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -3162,8 +3153,8 @@ int
 xfs_symlink(
        xfs_inode_t             *dp,
        bhv_vname_t             *dentry,
-       bhv_vattr_t             *vap,
        char                    *target_path,
+       mode_t                  mode,
        bhv_vnode_t             **vpp,
        cred_t                  *credp)
 {
@@ -3198,7 +3189,7 @@ xfs_symlink(
        ip = NULL;
        tp = NULL;
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
 
        if (XFS_FORCED_SHUTDOWN(mp))
@@ -3251,8 +3242,6 @@ xfs_symlink(
        udqp = gdqp = NULL;
        if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
                prid = dp->i_d.di_projid;
-       else if (vap->va_mask & XFS_AT_PROJID)
-               prid = (xfs_prid_t)vap->va_projid;
        else
                prid = (xfs_prid_t)dfltprid;
 
@@ -3321,7 +3310,7 @@ xfs_symlink(
        /*
         * Allocate an inode for the symlink.
         */
-       error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (vap->va_mode&~S_IFMT),
+       error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT),
                               1, 0, credp, prid, resblks > 0, &ip, NULL);
        if (error) {
                if (error == ENOSPC)
@@ -3477,23 +3466,14 @@ std_return:
 }
 
 
-/*
- * xfs_fid2
- *
- * A fid routine that takes a pointer to a previously allocated
- * fid structure (like xfs_fast_fid) but uses a 64 bit inode number.
- */
 int
 xfs_fid2(
        xfs_inode_t     *ip,
-       fid_t           *fidp)
+       xfs_fid_t       *xfid)
 {
-       xfs_fid2_t      *xfid = (xfs_fid2_t *)fidp;
-
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
-       ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
-       xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len);
+       xfid->fid_len = sizeof(xfs_fid_t) - sizeof(xfid->fid_len);
        xfid->fid_pad = 0;
        /*
         * use memcpy because the inode is a long long and there's no
@@ -3673,7 +3653,7 @@ xfs_reclaim(
 {
        bhv_vnode_t     *vp = XFS_ITOV(ip);
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        ASSERT(!VN_MAPPED(vp));
 
@@ -3683,7 +3663,7 @@ xfs_reclaim(
                return 0;
        }
 
-       vn_iowait(vp);
+       vn_iowait(ip);
 
        ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0);
 
@@ -3891,7 +3871,7 @@ xfs_alloc_file_space(
        int                     committed;
        int                     error;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -4161,7 +4141,7 @@ xfs_free_file_space(
        vp = XFS_ITOV(ip);
        mp = ip->i_mount;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
                return error;
@@ -4189,7 +4169,7 @@ xfs_free_file_space(
                need_iolock = 0;
        if (need_iolock) {
                xfs_ilock(ip, XFS_IOLOCK_EXCL);
-               vn_iowait(vp);  /* wait for the completion of any pending DIOs */
+               vn_iowait(ip);  /* wait for the completion of any pending DIOs */
        }
 
        rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP);
@@ -4367,7 +4347,7 @@ xfs_change_file_space(
        xfs_trans_t     *tp;
        bhv_vattr_t     va;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
 
        /*
         * must be a regular file and have write permission