kill xfs_get_dir_entry
PATCH 1/1 kill xfs_get_dir_entry
Instead of of xfs_get_dir_entry use a macro to get the xfs_inode from the dentry in the callers and grab the reference manually.
Only grab the reference once as it's fine to keep it over the dmapi calls. (And even that reference is actually superflous in Linux but I'll leave that for another patch)
Signed-off-by Christoph Hellwig <[email protected]>
fs/xfs/xfs_rename.c +4 -8
@@ -94,7 +94,8 @@ xfs_lock_for_rename( xfs_inode_t **i_tab,/* array of inode returned, sorted */ int *num_inodes) /* number of inodes in array */ { -xfs_inode_t *ip1, *ip2, *temp; +xfs_inode_t *ip1 =VNAME_TO_INODE (vname1); +xfs_inode_t *ip2, *temp;xfs_ino_t inum1, inum2;int error;int i, j;
@@ -110,16 +111,11 @@ xfs_lock_for_rename(* to see if we still have the right inodes, directories, etc. */ lock_mode =xfs_ilock_map_shared (dp1); - error =xfs_get_dir_entry (vname1, &ip1); -if (error) { -xfs_iunlock_map_shared (dp1, lock_mode); -return error; - } +IHOLD (ip1); +xfs_itrace_ref (ip1); inum1 = ip1->i_ino; -ASSERT (ip1); -xfs_itrace_ref (ip1);/* * Unlock dp1 and lock dp2 if they are different.
fs/xfs/linux-2.6/xfs_vnode.h +1 -1
@@ -230,7 +230,7 @@ static inline bhv_vnode_t *vn_grab(bhv_v*/ #define VNAME (dentry) ((char *) (dentry)->d_name.name)#define VNAMELEN (dentry) ((dentry)->d_name.len) -#define VNAME_TO_VNODE (dentry) (vn_from_inode((dentry)->d_inode)) +#define VNAME_TO_INODE (dentry) (XFS_I((dentry)->d_inode))/* * Dealing with bad inodes
fs/xfs/xfs_utils.c +0 -22
@@ -40,28 +40,6 @@#include "xfs_itable.h" #include "xfs_utils.h" -/* -* xfs_get_dir_entry is used to get a reference to an inode given -* its parent directory inode and the name of the file. It does -* not lock the child inode, and it unlocks the directory before -* returning. The directory's generation number is returned for -* use by a later call to xfs_lock_dir_and_entry. -*/ -int -xfs_get_dir_entry ( -bhv_vname_t *dentry, -xfs_inode_t **ipp) -{ -bhv_vnode_t *vp; - - vp =VNAME_TO_VNODE (dentry); - - *ipp =xfs_vtoi (vp); -if (!*ipp) -return XFS_ERROR (ENOENT ); -VN_HOLD (vp); -return 0 ; -}int xfs_dir_lookup_int(
fs/xfs/xfs_utils.h +0 -1
@@ -21,7 +21,6 @@#define IRELE (ip) VN_RELE(XFS_ITOV(ip))#define IHOLD (ip) VN_HOLD(XFS_ITOV(ip)) -extern int xfs_get_dir_entry (bhv_vname_t *,xfs_inode_t **);extern int xfs_dir_lookup_int (xfs_inode_t *,uint ,bhv_vname_t *,xfs_ino_t *,xfs_inode_t **);extern int xfs_truncate_file (xfs_mount_t *,xfs_inode_t *);
fs/xfs/xfs_vnodeops.c +9 -42
128 lines not on this page · raw message