]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/xfs_vnodeops.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
[linux-2.6-omap-h63xx.git] / fs / xfs / xfs_vnodeops.c
index 2b30fa690b4aaaa6346553caf968afce76ef1c3b..51305242ff8cb8b8793e4d19412adfdc309aa555 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);
+       xfs_itrace_entry(ip);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -136,7 +136,7 @@ xfs_getattr(
        default:
                vap->va_rdev = 0;
 
-               if (!(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
+               if (!(XFS_IS_REALTIME_INODE(ip))) {
                        vap->va_blocksize = xfs_preferred_iosize(mp);
                } else {
 
@@ -228,9 +228,9 @@ xfs_setattr(
        int                     file_owner;
        int                     need_iolock = 1;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
-       if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
                return XFS_ERROR(EROFS);
 
        /*
@@ -508,7 +508,7 @@ xfs_setattr(
                 */
                if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
                    (mask & XFS_AT_XFLAGS) &&
-                   (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
+                   (XFS_IS_REALTIME_INODE(ip)) !=
                    (vap->va_xflags & XFS_XFLAG_REALTIME)) {
                        code = XFS_ERROR(EINVAL);       /* EFBIG? */
                        goto error_return;
@@ -520,7 +520,7 @@ xfs_setattr(
                if ((mask & XFS_AT_EXTSIZE) && vap->va_extsize != 0) {
                        xfs_extlen_t    size;
 
-                       if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ||
+                       if (XFS_IS_REALTIME_INODE(ip) ||
                            ((mask & XFS_AT_XFLAGS) &&
                            (vap->va_xflags & XFS_XFLAG_REALTIME))) {
                                size = mp->m_sb.sb_rextsize <<
@@ -592,13 +592,13 @@ xfs_setattr(
                if (!code &&
                    (ip->i_size != ip->i_d.di_size) &&
                    (vap->va_size > ip->i_d.di_size)) {
-                       code = bhv_vop_flush_pages(XFS_ITOV(ip),
+                       code = xfs_flush_pages(ip,
                                        ip->i_d.di_size, vap->va_size,
                                        XFS_B_ASYNC, FI_NONE);
                }
 
                /* wait for all I/O to complete */
-               vn_iowait(vp);
+               vn_iowait(ip);
 
                if (!code)
                        code = xfs_itruncate_data(ip, vap->va_size);
@@ -660,7 +660,7 @@ xfs_setattr(
                         * vnode and flush it when the file is closed, and
                         * do not wait the usual (long) time for writeout.
                         */
-                       VTRUNCATE(vp);
+                       xfs_iflags_set(ip, XFS_ITRUNCATED);
                }
                /*
                 * Have to do this even if the file's size doesn't change.
@@ -804,12 +804,8 @@ xfs_setattr(
                                if (vap->va_xflags & XFS_XFLAG_EXTSZINHERIT)
                                        di_flags |= XFS_DIFLAG_EXTSZINHERIT;
                        } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
-                               if (vap->va_xflags & XFS_XFLAG_REALTIME) {
+                               if (vap->va_xflags & XFS_XFLAG_REALTIME)
                                        di_flags |= XFS_DIFLAG_REALTIME;
-                                       ip->i_iocore.io_flags |= XFS_IOCORE_RT;
-                               } else {
-                                       ip->i_iocore.io_flags &= ~XFS_IOCORE_RT;
-                               }
                                if (vap->va_xflags & XFS_XFLAG_EXTSIZE)
                                        di_flags |= XFS_DIFLAG_EXTSIZE;
                        }
@@ -864,10 +860,6 @@ xfs_setattr(
         * racing calls to vop_vnode_change.
         */
        mandlock_after = MANDLOCK(vp, ip->i_d.di_mode);
-       if (mandlock_before != mandlock_after) {
-               bhv_vop_vnode_change(vp, VCHANGE_FLAGS_ENF_LOCKING,
-                                mandlock_after);
-       }
 
        xfs_iunlock(ip, lock_flags);
 
@@ -906,28 +898,6 @@ xfs_setattr(
        return code;
 }
 
-
-/*
- * xfs_access
- * Null conversion from vnode mode bits to inode mode bits, as in efs.
- */
-int
-xfs_access(
-       xfs_inode_t     *ip,
-       int             mode,
-       cred_t          *credp)
-{
-       int             error;
-
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
-
-       xfs_ilock(ip, XFS_ILOCK_SHARED);
-       error = xfs_iaccess(ip, mode, credp);
-       xfs_iunlock(ip, XFS_ILOCK_SHARED);
-       return error;
-}
-
-
 /*
  * The maximum pathlen is 1024 bytes. Since the minimum file system
  * blocksize is 512 bytes, we can get a max of 2 extents back from
@@ -991,7 +961,7 @@ xfs_readlink(
        int             pathlen;
        int             error = 0;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -1037,7 +1007,7 @@ xfs_fsync(
        int             error;
        int             log_flushed = 0, changed = 1;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
        ASSERT(start >= 0 && stop >= -1);
 
@@ -1153,7 +1123,7 @@ xfs_fsync(
                 * If this inode is on the RT dev we need to flush that
                 * cache as well.
                 */
-               if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
+               if (XFS_IS_REALTIME_INODE(ip))
                        xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
        }
 
@@ -1192,7 +1162,7 @@ xfs_free_eofblocks(
 
        nimaps = 1;
        xfs_ilock(ip, XFS_ILOCK_SHARED);
-       error = XFS_BMAPI(mp, NULL, &ip->i_iocore, end_fsb, map_len, 0,
+       error = xfs_bmapi(NULL, ip, end_fsb, map_len, 0,
                          NULL, 0, &imap, &nimaps, NULL, NULL);
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
@@ -1519,10 +1489,12 @@ xfs_release(
                return 0;
 
        /* If this is a read-only mount, don't do this (would generate I/O) */
-       if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
                return 0;
 
        if (!XFS_FORCED_SHUTDOWN(mp)) {
+               int truncated;
+
                /*
                 * If we are using filestreams, and we have an unlinked
                 * file that we are processing the last close on, then nothing
@@ -1543,8 +1515,9 @@ xfs_release(
                 * significantly reducing the time window where we'd otherwise
                 * be exposed to that problem.
                 */
-               if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
-                       bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE);
+               truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
+               if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
+                       xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
        }
 
 #ifdef HAVE_REFCACHE
@@ -1563,9 +1536,6 @@ xfs_release(
                        error = xfs_free_eofblocks(mp, ip, XFS_FREE_EOF_LOCK);
                        if (error)
                                return error;
-                       /* Update linux inode block count after free above */
-                       vn_to_inode(vp)->i_blocks = XFS_FSB_TO_BB(mp,
-                               ip->i_d.di_nblocks + ip->i_delayed_blks);
                }
        }
 
@@ -1593,7 +1563,7 @@ xfs_inactive(
        int             error;
        int             truncate;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
        /*
         * If the inode is already free, then there can be nothing
@@ -1625,7 +1595,7 @@ xfs_inactive(
        error = 0;
 
        /* If this is a read-only mount, don't do this (would generate I/O) */
-       if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
                goto out;
 
        if (ip->i_d.di_nlink != 0) {
@@ -1639,9 +1609,6 @@ xfs_inactive(
                        error = xfs_free_eofblocks(mp, ip, XFS_FREE_EOF_LOCK);
                        if (error)
                                return VN_INACTIVE_CACHE;
-                       /* Update linux inode block count after free above */
-                       vn_to_inode(vp)->i_blocks = XFS_FSB_TO_BB(mp,
-                               ip->i_d.di_nblocks + ip->i_delayed_blks);
                }
                goto out;
        }
@@ -1806,7 +1773,7 @@ xfs_lookup(
        int                     error;
        uint                    lock_mode;
 
-       vn_trace_entry(XFS_ITOV(dp), __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(dp);
 
        if (XFS_FORCED_SHUTDOWN(dp->i_mount))
                return XFS_ERROR(EIO);
@@ -1815,7 +1782,7 @@ xfs_lookup(
        error = xfs_dir_lookup_int(dp, lock_mode, dentry, &e_inum, &ip);
        if (!error) {
                *vpp = XFS_ITOV(ip);
-               ITRACE(ip);
+               xfs_itrace_ref(ip);
        }
        xfs_iunlock_map_shared(dp, lock_mode);
        return error;
@@ -1825,7 +1792,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)
 {
@@ -1835,7 +1803,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;
@@ -1846,20 +1813,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);
+       xfs_itrace_entry(dp);
 
-       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;
@@ -1874,8 +1839,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;
 
@@ -1927,8 +1890,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) {
@@ -1936,7 +1898,7 @@ xfs_create(
                        goto error_return;
                goto abort_return;
        }
-       ITRACE(ip);
+       xfs_itrace_ref(ip);
 
        /*
         * At this point, we've gotten a newly allocated inode.
@@ -2008,12 +1970,6 @@ xfs_create(
        XFS_QM_DQRELE(mp, udqp);
        XFS_QM_DQRELE(mp, gdqp);
 
-       /*
-        * Propagate the fact that the vnode changed after the
-        * xfs_inode locks have been released.
-        */
-       bhv_vop_vnode_change(vp, VCHANGE_FLAGS_TRUNCATED, 3);
-
        *vpp = vp;
 
        /* Fallthrough to std_return with error = 0  */
@@ -2025,7 +1981,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;
 
@@ -2110,7 +2066,7 @@ again:
 
        e_inum = ip->i_ino;
 
-       ITRACE(ip);
+       xfs_itrace_ref(ip);
 
        /*
         * We want to lock in increasing inum. Since we've already
@@ -2333,7 +2289,7 @@ xfs_remove(
        uint                    resblks;
        int                     namelen;
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(dp);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -2376,9 +2332,8 @@ xfs_remove(
 
        dm_di_mode = ip->i_d.di_mode;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
-
-       ITRACE(ip);
+       xfs_itrace_entry(ip);
+       xfs_itrace_ref(ip);
 
        error = XFS_QM_DQATTACH(mp, dp, 0);
        if (!error && dp != ip)
@@ -2510,13 +2465,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);
-
-       /*
-        * Let interposed file systems know about removed links.
-        */
-       bhv_vop_link_removed(XFS_ITOV(ip), dir_vp, link_zero);
-
+       xfs_itrace_exit(ip);
        IRELE(ip);
 
 /*     Fall through to std_return with error = 0 */
@@ -2579,8 +2528,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);
+       xfs_itrace_entry(tdp);
+       xfs_itrace_entry(xfs_vtoi(src_vp));
 
        target_namelen = VNAMELEN(dentry);
        ASSERT(!VN_ISDIR(src_vp));
@@ -2721,7 +2670,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)
 {
@@ -2743,19 +2692,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;
@@ -2763,14 +2710,12 @@ xfs_mkdir(
 
        /* Return through std_return after this point. */
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(dp);
 
        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;
 
@@ -2823,7 +2768,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) {
@@ -2831,7 +2776,7 @@ xfs_mkdir(
                        goto error_return;
                goto abort_return;
        }
-       ITRACE(cdp);
+       xfs_itrace_ref(cdp);
 
        /*
         * Now we add the directory inode to the transaction.
@@ -2917,7 +2862,7 @@ std_return:
                                        created ? XFS_ITOV(cdp):NULL,
                                        DM_RIGHT_NULL,
                                        dir_name, NULL,
-                                       dm_di_mode, error, 0);
+                                       mode, error, 0);
        }
        return error;
 
@@ -2957,7 +2902,7 @@ xfs_rmdir(
        int                     last_cdp_link;
        uint                    resblks;
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(dp);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -3062,7 +3007,7 @@ xfs_rmdir(
                VN_HOLD(dir_vp);
        }
 
-       ITRACE(cdp);
+       xfs_itrace_ref(cdp);
        xfs_trans_ijoin(tp, cdp, XFS_ILOCK_EXCL);
 
        ASSERT(cdp->i_d.di_nlink >= 2);
@@ -3146,11 +3091,6 @@ xfs_rmdir(
        }
 
 
-       /*
-        * Let interposed file systems know about removed links.
-        */
-       bhv_vop_link_removed(XFS_ITOV(cdp), dir_vp, last_cdp_link);
-
        IRELE(cdp);
 
        /* Fall through to std_return with error = 0 or the errno
@@ -3179,8 +3119,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)
 {
@@ -3215,8 +3155,7 @@ xfs_symlink(
        ip = NULL;
        tp = NULL;
 
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
-
+       xfs_itrace_entry(dp);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -3268,8 +3207,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;
 
@@ -3338,14 +3275,14 @@ 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)
                        goto error_return;
                goto error1;
        }
-       ITRACE(ip);
+       xfs_itrace_ref(ip);
 
        /*
         * An error after we've joined dp to the transaction will result in the
@@ -3493,36 +3430,6 @@ std_return:
        goto 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_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));
-
-       xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len);
-       xfid->fid_pad = 0;
-       /*
-        * use memcpy because the inode is a long long and there's no
-        * assurance that xfid->fid_ino is properly aligned.
-        */
-       memcpy(&xfid->fid_ino, &ip->i_ino, sizeof(xfid->fid_ino));
-       xfid->fid_gen = ip->i_d.di_gen;
-
-       return 0;
-}
-
-
 int
 xfs_rwlock(
        xfs_inode_t     *ip,
@@ -3595,11 +3502,11 @@ xfs_inode_flush(
                if (iip && iip->ili_last_lsn) {
                        xlog_t          *log = mp->m_log;
                        xfs_lsn_t       sync_lsn;
-                       int             s, log_flags = XFS_LOG_FORCE;
+                       int             log_flags = XFS_LOG_FORCE;
 
-                       s = GRANT_LOCK(log);
+                       spin_lock(&log->l_grant_lock);
                        sync_lsn = log->l_last_sync_lsn;
-                       GRANT_UNLOCK(log, s);
+                       spin_unlock(&log->l_grant_lock);
 
                        if ((XFS_LSN_CMP(iip->ili_last_lsn, sync_lsn) > 0)) {
                                if (flags & FLUSH_SYNC)
@@ -3674,8 +3581,8 @@ xfs_set_dmattrs(
        xfs_ilock(ip, XFS_ILOCK_EXCL);
        xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
 
-       ip->i_iocore.io_dmevmask = ip->i_d.di_dmevmask = evmask;
-       ip->i_iocore.io_dmstate  = ip->i_d.di_dmstate  = state;
+       ip->i_d.di_dmevmask = evmask;
+       ip->i_d.di_dmstate  = state;
 
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
        IHOLD(ip);
@@ -3690,7 +3597,7 @@ xfs_reclaim(
 {
        bhv_vnode_t     *vp = XFS_ITOV(ip);
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
        ASSERT(!VN_MAPPED(vp));
 
@@ -3700,7 +3607,7 @@ xfs_reclaim(
                return 0;
        }
 
-       vn_iowait(vp);
+       vn_iowait(ip);
 
        ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0);
 
@@ -3732,7 +3639,8 @@ xfs_reclaim(
                XFS_MOUNT_ILOCK(mp);
                spin_lock(&ip->i_flags_lock);
                __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
-               vn_bhv_remove(VN_BHV_HEAD(vp), XFS_ITOBHV(ip));
+               vn_to_inode(vp)->i_private = NULL;
+               ip->i_vnode = NULL;
                spin_unlock(&ip->i_flags_lock);
                list_add_tail(&ip->i_reclaim, &mp->m_del_inodes);
                XFS_MOUNT_IUNLOCK(mp);
@@ -3907,7 +3815,7 @@ xfs_alloc_file_space(
        int                     committed;
        int                     error;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -4012,7 +3920,7 @@ retry:
                 * Issue the xfs_bmapi() call to allocate the blocks
                 */
                XFS_BMAP_INIT(&free_list, &firstfsb);
-               error = XFS_BMAPI(mp, tp, &ip->i_iocore, startoffset_fsb,
+               error = xfs_bmapi(tp, ip, startoffset_fsb,
                                  allocatesize_fsb, bmapi_flag,
                                  &firstfsb, 0, imapp, &nimaps,
                                  &free_list, NULL);
@@ -4088,13 +3996,13 @@ xfs_zero_remaining_bytes(
        int                     error = 0;
 
        bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
-                               ip->i_d.di_flags & XFS_DIFLAG_REALTIME ?
+                               XFS_IS_REALTIME_INODE(ip) ?
                                mp->m_rtdev_targp : mp->m_ddev_targp);
 
        for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
                offset_fsb = XFS_B_TO_FSBT(mp, offset);
                nimap = 1;
-               error = XFS_BMAPI(mp, NULL, &ip->i_iocore, offset_fsb, 1, 0,
+               error = xfs_bmapi(NULL, ip, offset_fsb, 1, 0,
                        NULL, 0, &imap, &nimap, NULL, NULL);
                if (error || nimap < 1)
                        break;
@@ -4177,7 +4085,7 @@ xfs_free_file_space(
        vp = XFS_ITOV(ip);
        mp = ip->i_mount;
 
-       vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
        if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
                return error;
@@ -4185,7 +4093,7 @@ xfs_free_file_space(
        error = 0;
        if (len <= 0)   /* if nothing being freed */
                return error;
-       rt = (ip->i_d.di_flags & XFS_DIFLAG_REALTIME);
+       rt = XFS_IS_REALTIME_INODE(ip);
        startoffset_fsb = XFS_B_TO_FSB(mp, offset);
        end_dmi_offset = offset + len;
        endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
@@ -4205,17 +4113,15 @@ 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);
+       rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
        ioffset = offset & ~(rounding - 1);
 
        if (VN_CACHED(vp) != 0) {
-               xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1,
-                               ctooff(offtoct(ioffset)), -1);
-               error = bhv_vop_flushinval_pages(vp, ctooff(offtoct(ioffset)),
-                               -1, FI_REMAPF_LOCKED);
+               xfs_inval_cached_trace(ip, ioffset, -1, ioffset, -1);
+               error = xfs_flushinval_pages(ip, ioffset, -1, FI_REMAPF_LOCKED);
                if (error)
                        goto out_unlock_iolock;
        }
@@ -4228,7 +4134,7 @@ xfs_free_file_space(
         */
        if (rt && !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) {
                nimap = 1;
-               error = XFS_BMAPI(mp, NULL, &ip->i_iocore, startoffset_fsb,
+               error = xfs_bmapi(NULL, ip, startoffset_fsb,
                        1, 0, NULL, 0, &imap, &nimap, NULL, NULL);
                if (error)
                        goto out_unlock_iolock;
@@ -4243,7 +4149,7 @@ xfs_free_file_space(
                                startoffset_fsb += mp->m_sb.sb_rextsize - mod;
                }
                nimap = 1;
-               error = XFS_BMAPI(mp, NULL, &ip->i_iocore, endoffset_fsb - 1,
+               error = xfs_bmapi(NULL, ip, endoffset_fsb - 1,
                        1, 0, NULL, 0, &imap, &nimap, NULL, NULL);
                if (error)
                        goto out_unlock_iolock;
@@ -4319,7 +4225,7 @@ xfs_free_file_space(
                 * issue the bunmapi() call to free the blocks
                 */
                XFS_BMAP_INIT(&free_list, &firstfsb);
-               error = XFS_BUNMAPI(mp, tp, &ip->i_iocore, startoffset_fsb,
+               error = xfs_bunmapi(tp, ip, startoffset_fsb,
                                  endoffset_fsb - startoffset_fsb,
                                  0, 2, &firstfsb, &free_list, NULL, &done);
                if (error) {
@@ -4382,23 +4288,11 @@ xfs_change_file_space(
        xfs_trans_t     *tp;
        bhv_vattr_t     va;
 
-       vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
+       xfs_itrace_entry(ip);
 
-       /*
-        * must be a regular file and have write permission
-        */
        if (!S_ISREG(ip->i_d.di_mode))
                return XFS_ERROR(EINVAL);
 
-       xfs_ilock(ip, XFS_ILOCK_SHARED);
-
-       if ((error = xfs_iaccess(ip, S_IWUSR, credp))) {
-               xfs_iunlock(ip, XFS_ILOCK_SHARED);
-               return error;
-       }
-
-       xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
        switch (bf->l_whence) {
        case 0: /*SEEK_SET*/
                break;