diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:55 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:28 -0500 |
commit | fb045adb99d9b7c562dc7fef834857f78249daa1 (patch) | |
tree | 1fd6a4024fffeec568abe100d730589bfdb81c38 /fs/ocfs2 | |
parent | 5f57cbcc02cf18f6b22ef4066bb10afeb8f930ff (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')
-rw-r--r-- | fs/ocfs2/export.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 19ad145d2af3..6adafa576065 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c | |||
@@ -138,7 +138,7 @@ check_gen: | |||
138 | 138 | ||
139 | result = d_obtain_alias(inode); | 139 | result = d_obtain_alias(inode); |
140 | if (!IS_ERR(result)) | 140 | if (!IS_ERR(result)) |
141 | result->d_op = &ocfs2_dentry_ops; | 141 | d_set_d_op(result, &ocfs2_dentry_ops); |
142 | else | 142 | else |
143 | mlog_errno(PTR_ERR(result)); | 143 | mlog_errno(PTR_ERR(result)); |
144 | 144 | ||
@@ -176,7 +176,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) | |||
176 | 176 | ||
177 | parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0)); | 177 | parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0)); |
178 | if (!IS_ERR(parent)) | 178 | if (!IS_ERR(parent)) |
179 | parent->d_op = &ocfs2_dentry_ops; | 179 | d_set_d_op(parent, &ocfs2_dentry_ops); |
180 | 180 | ||
181 | bail_unlock: | 181 | bail_unlock: |
182 | ocfs2_inode_unlock(dir, 0); | 182 | ocfs2_inode_unlock(dir, 0); |
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 | ||
149 | bail_add: | 149 | bail_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 | ||
749 | out_commit: | 749 | out_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; |
2465 | out_commit: | 2465 | out_commit: |