提交 907f49a8 编写于 作者: C Christoph Hellwig 提交者: Lachlan McIlroy

[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: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
上级 0b1f9177
...@@ -82,24 +82,6 @@ vn_ioerror( ...@@ -82,24 +82,6 @@ vn_ioerror(
xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l); xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l);
} }
/*
* Add a reference to a referenced vnode.
*/
bhv_vnode_t *
vn_hold(
bhv_vnode_t *vp)
{
struct inode *inode;
XFS_STATS_INC(vn_hold);
inode = igrab(vp);
ASSERT(inode);
return vp;
}
#ifdef XFS_INODE_TRACE #ifdef XFS_INODE_TRACE
/* /*
......
...@@ -69,22 +69,18 @@ static inline int vn_count(bhv_vnode_t *vp) ...@@ -69,22 +69,18 @@ static inline int vn_count(bhv_vnode_t *vp)
return atomic_read(&vp->i_count); return atomic_read(&vp->i_count);
} }
/* #define IHOLD(ip) \
* Vnode reference counting functions (and macros for compatibility). do { \
*/ ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
extern bhv_vnode_t *vn_hold(bhv_vnode_t *); atomic_inc(&(VFS_I(ip)->i_count)); \
xfs_itrace_hold((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
#if defined(XFS_INODE_TRACE) } while (0)
#define VN_HOLD(vp) \
((void)vn_hold(vp), \ #define IRELE(ip) \
xfs_itrace_hold(XFS_I(vp), __FILE__, __LINE__, (inst_t *)__return_address)) do { \
#define VN_RELE(vp) \ xfs_itrace_rele((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
(xfs_itrace_rele(XFS_I(vp), __FILE__, __LINE__, (inst_t *)__return_address), \ iput(VFS_I(ip)); \
iput(vp)) } while (0)
#else
#define VN_HOLD(vp) ((void)vn_hold(vp))
#define VN_RELE(vp) (iput(vp))
#endif
static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp) static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp)
{ {
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
#ifndef __XFS_UTILS_H__ #ifndef __XFS_UTILS_H__
#define __XFS_UTILS_H__ #define __XFS_UTILS_H__
#define IRELE(ip) VN_RELE(VFS_I(ip))
#define IHOLD(ip) VN_HOLD(VFS_I(ip))
extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *); extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *);
extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t,
xfs_dev_t, cred_t *, prid_t, int, xfs_dev_t, cred_t *, prid_t, int,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册