aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
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/autofs4
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/autofs4')
-rw-r--r--fs/autofs4/inode.c2
-rw-r--r--fs/autofs4/root.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index ac87e49fa706..a7bdb9dcac84 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -309,7 +309,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
309 goto fail_iput; 309 goto fail_iput;
310 pipe = NULL; 310 pipe = NULL;
311 311
312 root->d_op = &autofs4_sb_dentry_operations; 312 d_set_d_op(root, &autofs4_sb_dentry_operations);
313 root->d_fsdata = ino; 313 root->d_fsdata = ino;
314 314
315 /* Can this call block? */ 315 /* Can this call block? */
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 10ca68a96dc7..bfe3f2eb684d 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -571,7 +571,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
571 * we check for the hashed dentry and return the newly 571 * we check for the hashed dentry and return the newly
572 * hashed dentry. 572 * hashed dentry.
573 */ 573 */
574 dentry->d_op = &autofs4_root_dentry_operations; 574 d_set_d_op(dentry, &autofs4_root_dentry_operations);
575 575
576 /* 576 /*
577 * And we need to ensure that the same dentry is used for 577 * And we need to ensure that the same dentry is used for
@@ -710,9 +710,9 @@ static int autofs4_dir_symlink(struct inode *dir,
710 d_add(dentry, inode); 710 d_add(dentry, inode);
711 711
712 if (dir == dir->i_sb->s_root->d_inode) 712 if (dir == dir->i_sb->s_root->d_inode)
713 dentry->d_op = &autofs4_root_dentry_operations; 713 d_set_d_op(dentry, &autofs4_root_dentry_operations);
714 else 714 else
715 dentry->d_op = &autofs4_dentry_operations; 715 d_set_d_op(dentry, &autofs4_dentry_operations);
716 716
717 dentry->d_fsdata = ino; 717 dentry->d_fsdata = ino;
718 ino->dentry = dget(dentry); 718 ino->dentry = dget(dentry);
@@ -845,9 +845,9 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
845 d_add(dentry, inode); 845 d_add(dentry, inode);
846 846
847 if (dir == dir->i_sb->s_root->d_inode) 847 if (dir == dir->i_sb->s_root->d_inode)
848 dentry->d_op = &autofs4_root_dentry_operations; 848 d_set_d_op(dentry, &autofs4_root_dentry_operations);
849 else 849 else
850 dentry->d_op = &autofs4_dentry_operations; 850 d_set_d_op(dentry, &autofs4_dentry_operations);
851 851
852 dentry->d_fsdata = ino; 852 dentry->d_fsdata = ino;
853 ino->dentry = dget(dentry); 853 ino->dentry = dget(dentry);