aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@kernel.dk>2011-01-07 01:49:55 -0500
committerNick Piggin <npiggin@kernel.dk>2011-01-07 01:50:28 -0500
commitfb045adb99d9b7c562dc7fef834857f78249daa1 (patch)
tree1fd6a4024fffeec568abe100d730589bfdb81c38 /fs/ocfs2/namei.c
parent5f57cbcc02cf18f6b22ef4066bb10afeb8f930ff (diff)
fs: dcache reduce branches in lookup path
Reduce some branches and memory accesses in dcache lookup by adding dentry flags to indicate common d_ops are set, rather than having to check them. This saves a pointer memory access (dentry->d_op) in common path lookup situations, and saves another pointer load and branch in cases where we have d_op but not the particular operation. Patched with: git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index ff5744e1e36f..d14cad6e2e41 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -147,7 +147,7 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry,
147 spin_unlock(&oi->ip_lock); 147 spin_unlock(&oi->ip_lock);
148 148
149bail_add: 149bail_add:
150 dentry->d_op = &ocfs2_dentry_ops; 150 d_set_d_op(dentry, &ocfs2_dentry_ops);
151 ret = d_splice_alias(inode, dentry); 151 ret = d_splice_alias(inode, dentry);
152 152
153 if (inode) { 153 if (inode) {
@@ -415,7 +415,7 @@ static int ocfs2_mknod(struct inode *dir,
415 mlog_errno(status); 415 mlog_errno(status);
416 goto leave; 416 goto leave;
417 } 417 }
418 dentry->d_op = &ocfs2_dentry_ops; 418 d_set_d_op(dentry, &ocfs2_dentry_ops);
419 419
420 status = ocfs2_add_entry(handle, dentry, inode, 420 status = ocfs2_add_entry(handle, dentry, inode,
421 OCFS2_I(inode)->ip_blkno, parent_fe_bh, 421 OCFS2_I(inode)->ip_blkno, parent_fe_bh,
@@ -743,7 +743,7 @@ static int ocfs2_link(struct dentry *old_dentry,
743 } 743 }
744 744
745 ihold(inode); 745 ihold(inode);
746 dentry->d_op = &ocfs2_dentry_ops; 746 d_set_d_op(dentry, &ocfs2_dentry_ops);
747 d_instantiate(dentry, inode); 747 d_instantiate(dentry, inode);
748 748
749out_commit: 749out_commit:
@@ -1794,7 +1794,7 @@ static int ocfs2_symlink(struct inode *dir,
1794 mlog_errno(status); 1794 mlog_errno(status);
1795 goto bail; 1795 goto bail;
1796 } 1796 }
1797 dentry->d_op = &ocfs2_dentry_ops; 1797 d_set_d_op(dentry, &ocfs2_dentry_ops);
1798 1798
1799 status = ocfs2_add_entry(handle, dentry, inode, 1799 status = ocfs2_add_entry(handle, dentry, inode,
1800 le64_to_cpu(fe->i_blkno), parent_fe_bh, 1800 le64_to_cpu(fe->i_blkno), parent_fe_bh,
@@ -2459,7 +2459,7 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2459 goto out_commit; 2459 goto out_commit;
2460 } 2460 }
2461 2461
2462 dentry->d_op = &ocfs2_dentry_ops; 2462 d_set_d_op(dentry, &ocfs2_dentry_ops);
2463 d_instantiate(dentry, inode); 2463 d_instantiate(dentry, inode);
2464 status = 0; 2464 status = 0;
2465out_commit: 2465out_commit: