Commit df80c933 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Lachlan McIlroy

[XFS] remove some easy bhv_vnode_t instances

In various places we can just move a VFS_I call into the argument list of
called functions/macros instead of having a local bhv_vnode_t.

SGI-PV: 981498

SGI-Modid: xfs-linux-melb:xfs-kern:31776a
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent e1cccd91
...@@ -980,12 +980,7 @@ STATIC struct inode * ...@@ -980,12 +980,7 @@ STATIC struct inode *
xfs_fs_alloc_inode( xfs_fs_alloc_inode(
struct super_block *sb) struct super_block *sb)
{ {
bhv_vnode_t *vp; return kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP);
vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP);
if (unlikely(!vp))
return NULL;
return vp;
} }
STATIC void STATIC void
......
...@@ -130,7 +130,6 @@ xfs_swap_extents( ...@@ -130,7 +130,6 @@ xfs_swap_extents(
xfs_mount_t *mp; xfs_mount_t *mp;
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_bstat_t *sbp = &sxp->sx_stat; xfs_bstat_t *sbp = &sxp->sx_stat;
bhv_vnode_t *vp, *tvp;
xfs_ifork_t *tempifp, *ifp, *tifp; xfs_ifork_t *tempifp, *ifp, *tifp;
int ilf_fields, tilf_fields; int ilf_fields, tilf_fields;
static uint lock_flags = XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL; static uint lock_flags = XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL;
...@@ -149,8 +148,6 @@ xfs_swap_extents( ...@@ -149,8 +148,6 @@ xfs_swap_extents(
} }
sbp = &sxp->sx_stat; sbp = &sxp->sx_stat;
vp = VFS_I(ip);
tvp = VFS_I(tip);
xfs_lock_two_inodes(ip, tip, lock_flags); xfs_lock_two_inodes(ip, tip, lock_flags);
locked = 1; locked = 1;
...@@ -174,7 +171,7 @@ xfs_swap_extents( ...@@ -174,7 +171,7 @@ xfs_swap_extents(
goto error0; goto error0;
} }
if (VN_CACHED(tvp) != 0) { if (VN_CACHED(VFS_I(tip)) != 0) {
xfs_inval_cached_trace(tip, 0, -1, 0, -1); xfs_inval_cached_trace(tip, 0, -1, 0, -1);
error = xfs_flushinval_pages(tip, 0, -1, error = xfs_flushinval_pages(tip, 0, -1,
FI_REMAPF_LOCKED); FI_REMAPF_LOCKED);
...@@ -183,7 +180,7 @@ xfs_swap_extents( ...@@ -183,7 +180,7 @@ xfs_swap_extents(
} }
/* Verify O_DIRECT for ftmp */ /* Verify O_DIRECT for ftmp */
if (VN_CACHED(tvp) != 0) { if (VN_CACHED(VFS_I(tip)) != 0) {
error = XFS_ERROR(EINVAL); error = XFS_ERROR(EINVAL);
goto error0; goto error0;
} }
...@@ -227,7 +224,7 @@ xfs_swap_extents( ...@@ -227,7 +224,7 @@ xfs_swap_extents(
* vop_read (or write in the case of autogrow) they block on the iolock * vop_read (or write in the case of autogrow) they block on the iolock
* until we have switched the extents. * until we have switched the extents.
*/ */
if (VN_MAPPED(vp)) { if (VN_MAPPED(VFS_I(ip))) {
error = XFS_ERROR(EBUSY); error = XFS_ERROR(EBUSY);
goto error0; goto error0;
} }
......
...@@ -1399,7 +1399,6 @@ xfs_itruncate_start( ...@@ -1399,7 +1399,6 @@ xfs_itruncate_start(
xfs_fsize_t last_byte; xfs_fsize_t last_byte;
xfs_off_t toss_start; xfs_off_t toss_start;
xfs_mount_t *mp; xfs_mount_t *mp;
bhv_vnode_t *vp;
int error = 0; int error = 0;
ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));
...@@ -1408,7 +1407,6 @@ xfs_itruncate_start( ...@@ -1408,7 +1407,6 @@ xfs_itruncate_start(
(flags == XFS_ITRUNC_MAYBE)); (flags == XFS_ITRUNC_MAYBE));
mp = ip->i_mount; mp = ip->i_mount;
vp = VFS_I(ip);
/* wait for the completion of any pending DIOs */ /* wait for the completion of any pending DIOs */
if (new_size < ip->i_size) if (new_size < ip->i_size)
...@@ -1457,7 +1455,7 @@ xfs_itruncate_start( ...@@ -1457,7 +1455,7 @@ xfs_itruncate_start(
#ifdef DEBUG #ifdef DEBUG
if (new_size == 0) { if (new_size == 0) {
ASSERT(VN_CACHED(vp) == 0); ASSERT(VN_CACHED(VFS_I(ip)) == 0);
} }
#endif #endif
return error; return error;
...@@ -3465,7 +3463,6 @@ xfs_iflush_all( ...@@ -3465,7 +3463,6 @@ xfs_iflush_all(
xfs_mount_t *mp) xfs_mount_t *mp)
{ {
xfs_inode_t *ip; xfs_inode_t *ip;
bhv_vnode_t *vp;
again: again:
XFS_MOUNT_ILOCK(mp); XFS_MOUNT_ILOCK(mp);
...@@ -3480,14 +3477,13 @@ xfs_iflush_all( ...@@ -3480,14 +3477,13 @@ xfs_iflush_all(
continue; continue;
} }
vp = VFS_I(ip); if (!VFS_I(ip)) {
if (!vp) {
XFS_MOUNT_IUNLOCK(mp); XFS_MOUNT_IUNLOCK(mp);
xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC); xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);
goto again; goto again;
} }
ASSERT(vn_count(vp) == 0); ASSERT(vn_count(VFS_I(ip)) == 0);
ip = ip->i_mnext; ip = ip->i_mnext;
} while (ip != mp->m_inodes); } while (ip != mp->m_inodes);
......
...@@ -59,7 +59,6 @@ xfs_bulkstat_one_iget( ...@@ -59,7 +59,6 @@ xfs_bulkstat_one_iget(
{ {
xfs_icdinode_t *dic; /* dinode core info pointer */ xfs_icdinode_t *dic; /* dinode core info pointer */
xfs_inode_t *ip; /* incore inode pointer */ xfs_inode_t *ip; /* incore inode pointer */
bhv_vnode_t *vp;
int error; int error;
error = xfs_iget(mp, NULL, ino, error = xfs_iget(mp, NULL, ino,
...@@ -72,7 +71,6 @@ xfs_bulkstat_one_iget( ...@@ -72,7 +71,6 @@ xfs_bulkstat_one_iget(
ASSERT(ip != NULL); ASSERT(ip != NULL);
ASSERT(ip->i_blkno != (xfs_daddr_t)0); ASSERT(ip->i_blkno != (xfs_daddr_t)0);
vp = VFS_I(ip);
dic = &ip->i_d; dic = &ip->i_d;
/* xfs_iget returns the following without needing /* xfs_iget returns the following without needing
...@@ -85,7 +83,7 @@ xfs_bulkstat_one_iget( ...@@ -85,7 +83,7 @@ xfs_bulkstat_one_iget(
buf->bs_uid = dic->di_uid; buf->bs_uid = dic->di_uid;
buf->bs_gid = dic->di_gid; buf->bs_gid = dic->di_gid;
buf->bs_size = dic->di_size; buf->bs_size = dic->di_size;
vn_atime_to_bstime(vp, &buf->bs_atime); vn_atime_to_bstime(VFS_I(ip), &buf->bs_atime);
buf->bs_mtime.tv_sec = dic->di_mtime.t_sec; buf->bs_mtime.tv_sec = dic->di_mtime.t_sec;
buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec; buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec;
buf->bs_ctime.tv_sec = dic->di_ctime.t_sec; buf->bs_ctime.tv_sec = dic->di_ctime.t_sec;
......
...@@ -128,7 +128,6 @@ xfs_unmount_flush( ...@@ -128,7 +128,6 @@ xfs_unmount_flush(
xfs_inode_t *rip = mp->m_rootip; xfs_inode_t *rip = mp->m_rootip;
xfs_inode_t *rbmip; xfs_inode_t *rbmip;
xfs_inode_t *rsumip = NULL; xfs_inode_t *rsumip = NULL;
bhv_vnode_t *rvp = VFS_I(rip);
int error; int error;
xfs_ilock(rip, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); xfs_ilock(rip, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
...@@ -167,7 +166,7 @@ xfs_unmount_flush( ...@@ -167,7 +166,7 @@ xfs_unmount_flush(
if (error == EFSCORRUPTED) if (error == EFSCORRUPTED)
goto fscorrupt_out2; goto fscorrupt_out2;
if (vn_count(rvp) != 1 && !relocation) { if (vn_count(VFS_I(rip)) != 1 && !relocation) {
xfs_iunlock(rip, XFS_ILOCK_EXCL); xfs_iunlock(rip, XFS_ILOCK_EXCL);
return XFS_ERROR(EBUSY); return XFS_ERROR(EBUSY);
} }
......
...@@ -1160,7 +1160,6 @@ int ...@@ -1160,7 +1160,6 @@ int
xfs_release( xfs_release(
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
bhv_vnode_t *vp = VFS_I(ip);
xfs_mount_t *mp = ip->i_mount; xfs_mount_t *mp = ip->i_mount;
int error; int error;
...@@ -1195,13 +1194,13 @@ xfs_release( ...@@ -1195,13 +1194,13 @@ xfs_release(
* be exposed to that problem. * be exposed to that problem.
*/ */
truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED); truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0) if (truncated && VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0)
xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE); xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
} }
if (ip->i_d.di_nlink != 0) { if (ip->i_d.di_nlink != 0) {
if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) &&
((ip->i_size > 0) || (VN_CACHED(vp) > 0 || ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||
ip->i_delayed_blks > 0)) && ip->i_delayed_blks > 0)) &&
(ip->i_df.if_flags & XFS_IFEXTENTS)) && (ip->i_df.if_flags & XFS_IFEXTENTS)) &&
(!(ip->i_d.di_flags & (!(ip->i_d.di_flags &
...@@ -1227,7 +1226,6 @@ int ...@@ -1227,7 +1226,6 @@ int
xfs_inactive( xfs_inactive(
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
bhv_vnode_t *vp = VFS_I(ip);
xfs_bmap_free_t free_list; xfs_bmap_free_t free_list;
xfs_fsblock_t first_block; xfs_fsblock_t first_block;
int committed; int committed;
...@@ -1242,7 +1240,7 @@ xfs_inactive( ...@@ -1242,7 +1240,7 @@ xfs_inactive(
* If the inode is already free, then there can be nothing * If the inode is already free, then there can be nothing
* to clean up here. * to clean up here.
*/ */
if (ip->i_d.di_mode == 0 || VN_BAD(vp)) { if (ip->i_d.di_mode == 0 || VN_BAD(VFS_I(ip))) {
ASSERT(ip->i_df.if_real_bytes == 0); ASSERT(ip->i_df.if_real_bytes == 0);
ASSERT(ip->i_df.if_broot_bytes == 0); ASSERT(ip->i_df.if_broot_bytes == 0);
return VN_INACTIVE_CACHE; return VN_INACTIVE_CACHE;
...@@ -1272,7 +1270,7 @@ xfs_inactive( ...@@ -1272,7 +1270,7 @@ xfs_inactive(
if (ip->i_d.di_nlink != 0) { if (ip->i_d.di_nlink != 0) {
if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) &&
((ip->i_size > 0) || (VN_CACHED(vp) > 0 || ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||
ip->i_delayed_blks > 0)) && ip->i_delayed_blks > 0)) &&
(ip->i_df.if_flags & XFS_IFEXTENTS) && (ip->i_df.if_flags & XFS_IFEXTENTS) &&
(!(ip->i_d.di_flags & (!(ip->i_d.di_flags &
...@@ -2793,14 +2791,13 @@ int ...@@ -2793,14 +2791,13 @@ int
xfs_reclaim( xfs_reclaim(
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
bhv_vnode_t *vp = VFS_I(ip);
xfs_itrace_entry(ip); xfs_itrace_entry(ip);
ASSERT(!VN_MAPPED(vp)); ASSERT(!VN_MAPPED(VFS_I(ip)));
/* bad inode, get out here ASAP */ /* bad inode, get out here ASAP */
if (VN_BAD(vp)) { if (VN_BAD(VFS_I(ip))) {
xfs_ireclaim(ip); xfs_ireclaim(ip);
return 0; return 0;
} }
...@@ -2837,7 +2834,7 @@ xfs_reclaim( ...@@ -2837,7 +2834,7 @@ xfs_reclaim(
XFS_MOUNT_ILOCK(mp); XFS_MOUNT_ILOCK(mp);
spin_lock(&ip->i_flags_lock); spin_lock(&ip->i_flags_lock);
__xfs_iflags_set(ip, XFS_IRECLAIMABLE); __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
vp->i_private = NULL; VFS_I(ip)->i_private = NULL;
ip->i_vnode = NULL; ip->i_vnode = NULL;
spin_unlock(&ip->i_flags_lock); spin_unlock(&ip->i_flags_lock);
list_add_tail(&ip->i_reclaim, &mp->m_del_inodes); list_add_tail(&ip->i_reclaim, &mp->m_del_inodes);
...@@ -3241,7 +3238,6 @@ xfs_free_file_space( ...@@ -3241,7 +3238,6 @@ xfs_free_file_space(
xfs_off_t len, xfs_off_t len,
int attr_flags) int attr_flags)
{ {
bhv_vnode_t *vp;
int committed; int committed;
int done; int done;
xfs_off_t end_dmi_offset; xfs_off_t end_dmi_offset;
...@@ -3261,7 +3257,6 @@ xfs_free_file_space( ...@@ -3261,7 +3257,6 @@ xfs_free_file_space(
xfs_trans_t *tp; xfs_trans_t *tp;
int need_iolock = 1; int need_iolock = 1;
vp = VFS_I(ip);
mp = ip->i_mount; mp = ip->i_mount;
xfs_itrace_entry(ip); xfs_itrace_entry(ip);
...@@ -3298,7 +3293,7 @@ xfs_free_file_space( ...@@ -3298,7 +3293,7 @@ xfs_free_file_space(
rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE); rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
ioffset = offset & ~(rounding - 1); ioffset = offset & ~(rounding - 1);
if (VN_CACHED(vp) != 0) { if (VN_CACHED(VFS_I(ip)) != 0) {
xfs_inval_cached_trace(ip, ioffset, -1, ioffset, -1); xfs_inval_cached_trace(ip, ioffset, -1, ioffset, -1);
error = xfs_flushinval_pages(ip, ioffset, -1, FI_REMAPF_LOCKED); error = xfs_flushinval_pages(ip, ioffset, -1, FI_REMAPF_LOCKED);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment