summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-12-03 12:20:27 +0100
committerNiv Sardi <xaiki@sgi.com>2008-12-04 15:39:21 +1100
commitd9424b3c4a1e96f87c6cfd4d8dd2f8d9bbb4dcc5 (patch)
tree5f849561a23be97f4d90512551405c79f4b44748
parent5d765b976c3a41faf9a73718fb8cc5833990a8ef (diff)
downloadop-kernel-dev-d9424b3c4a1e96f87c6cfd4d8dd2f8d9bbb4dcc5.zip
op-kernel-dev-d9424b3c4a1e96f87c6cfd4d8dd2f8d9bbb4dcc5.tar.gz
stop using igrab in xfs_vn_link
->link is guranteed to get an already reference inode passed so we can do a simple increment of i_count instead of using igrab and thus avoid banging on the global inode_lock. This is what most filesystems already do. Also move the increment after the call to xfs_link to simplify error handling. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Niv Sardi <xaiki@sgi.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 2903faf..76b570d 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -367,21 +367,18 @@ xfs_vn_link(
struct inode *dir,
struct dentry *dentry)
{
- struct inode *inode; /* inode of guy being linked to */
+ struct inode *inode = old_dentry->d_inode;
struct xfs_name name;
int error;
- inode = old_dentry->d_inode;
xfs_dentry_to_name(&name, dentry);
- igrab(inode);
error = xfs_link(XFS_I(dir), XFS_I(inode), &name);
- if (unlikely(error)) {
- iput(inode);
+ if (unlikely(error))
return -error;
- }
xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED);
+ atomic_inc(&inode->i_count);
d_instantiate(dentry, inode);
return 0;
}
OpenPOWER on IntegriCloud