aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-08-13 02:13:45 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-08-13 02:13:45 -0400
commit907f49a8f552acc5d75635e86d567f05daf5c0d8 (patch)
treea6c835cf6b5be39111c0107039e8123e273339a2 /fs/xfs
parent0b1f917730dc2276fadbd9813ac3666abd7b1cbd (diff)
[XFS] implement IHOLD/IRELE directly
Now that all direct calls to VN_HOLD/VN_RELE are gone we can implement IHOLD/IRELE directly. For the IHOLD case also replace igrab with a direct increment of i_count because we are guaranteed to already have a live and referenced inode by the VFS. Also remove the vn_hold statistic because it's been rather meaningless for some time with most references done by other callers. SGI-PV: 981498 SGI-Modid: xfs-linux-melb:xfs-kern:31764a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h28
-rw-r--r--fs/xfs/xfs_utils.h3
3 files changed, 12 insertions, 37 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index 4af972b0166c..1c5a34f5c3c0 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -82,24 +82,6 @@ vn_ioerror(
82 xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l); 82 xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l);
83} 83}
84 84
85
86/*
87 * Add a reference to a referenced vnode.
88 */
89bhv_vnode_t *
90vn_hold(
91 bhv_vnode_t *vp)
92{
93 struct inode *inode;
94
95 XFS_STATS_INC(vn_hold);
96
97 inode = igrab(vp);
98 ASSERT(inode);
99
100 return vp;
101}
102
103#ifdef XFS_INODE_TRACE 85#ifdef XFS_INODE_TRACE
104 86
105/* 87/*
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index cc53687ff826..0d7eac03bdf0 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -69,22 +69,18 @@ static inline int vn_count(bhv_vnode_t *vp)
69 return atomic_read(&vp->i_count); 69 return atomic_read(&vp->i_count);
70} 70}
71 71
72/* 72#define IHOLD(ip) \
73 * Vnode reference counting functions (and macros for compatibility). 73do { \
74 */ 74 ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
75extern bhv_vnode_t *vn_hold(bhv_vnode_t *); 75 atomic_inc(&(VFS_I(ip)->i_count)); \
76 76 xfs_itrace_hold((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
77#if defined(XFS_INODE_TRACE) 77} while (0)
78#define VN_HOLD(vp) \ 78
79 ((void)vn_hold(vp), \ 79#define IRELE(ip) \
80 xfs_itrace_hold(XFS_I(vp), __FILE__, __LINE__, (inst_t *)__return_address)) 80do { \
81#define VN_RELE(vp) \ 81 xfs_itrace_rele((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
82 (xfs_itrace_rele(XFS_I(vp), __FILE__, __LINE__, (inst_t *)__return_address), \ 82 iput(VFS_I(ip)); \
83 iput(vp)) 83} while (0)
84#else
85#define VN_HOLD(vp) ((void)vn_hold(vp))
86#define VN_RELE(vp) (iput(vp))
87#endif
88 84
89static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp) 85static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp)
90{ 86{
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h
index 7b533dfea603..ef321225d269 100644
--- a/fs/xfs/xfs_utils.h
+++ b/fs/xfs/xfs_utils.h
@@ -18,9 +18,6 @@
18#ifndef __XFS_UTILS_H__ 18#ifndef __XFS_UTILS_H__
19#define __XFS_UTILS_H__ 19#define __XFS_UTILS_H__
20 20
21#define IRELE(ip) VN_RELE(VFS_I(ip))
22#define IHOLD(ip) VN_HOLD(VFS_I(ip))
23
24extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *); 21extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *);
25extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, 22extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t,
26 xfs_dev_t, cred_t *, prid_t, int, 23 xfs_dev_t, cred_t *, prid_t, int,