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/ncpfs/dir.c | |
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/ncpfs/dir.c')
-rw-r--r-- | fs/ncpfs/dir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 0ba3cdc95a44..4b9cbb28d7fa 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -633,7 +633,7 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | |||
633 | entry->ino = iunique(dir->i_sb, 2); | 633 | entry->ino = iunique(dir->i_sb, 2); |
634 | inode = ncp_iget(dir->i_sb, entry); | 634 | inode = ncp_iget(dir->i_sb, entry); |
635 | if (inode) { | 635 | if (inode) { |
636 | newdent->d_op = &ncp_dentry_operations; | 636 | d_set_d_op(newdent, &ncp_dentry_operations); |
637 | d_instantiate(newdent, inode); | 637 | d_instantiate(newdent, inode); |
638 | if (!hashed) | 638 | if (!hashed) |
639 | d_rehash(newdent); | 639 | d_rehash(newdent); |
@@ -889,7 +889,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, struc | |||
889 | if (inode) { | 889 | if (inode) { |
890 | ncp_new_dentry(dentry); | 890 | ncp_new_dentry(dentry); |
891 | add_entry: | 891 | add_entry: |
892 | dentry->d_op = &ncp_dentry_operations; | 892 | d_set_d_op(dentry, &ncp_dentry_operations); |
893 | d_add(dentry, inode); | 893 | d_add(dentry, inode); |
894 | error = 0; | 894 | error = 0; |
895 | } | 895 | } |