aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
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/ncpfs
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/ncpfs')
-rw-r--r--fs/ncpfs/dir.c4
-rw-r--r--fs/ncpfs/inode.c2
2 files changed, 3 insertions, 3 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);
891add_entry: 891add_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 }
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 60047dbeb38d..0c75a5f3cafd 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -717,7 +717,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
717 sb->s_root = d_alloc_root(root_inode); 717 sb->s_root = d_alloc_root(root_inode);
718 if (!sb->s_root) 718 if (!sb->s_root)
719 goto out_no_root; 719 goto out_no_root;
720 sb->s_root->d_op = &ncp_root_dentry_operations; 720 d_set_d_op(sb->s_root, &ncp_root_dentry_operations);
721 return 0; 721 return 0;
722 722
723out_no_root: 723out_no_root: