aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat
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/fat
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/fat')
-rw-r--r--fs/fat/inode.c4
-rw-r--r--fs/fat/namei_msdos.c6
-rw-r--r--fs/fat/namei_vfat.c8
3 files changed, 9 insertions, 9 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 8cccfebee180..206351af7c58 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -750,7 +750,7 @@ static struct dentry *fat_fh_to_dentry(struct super_block *sb,
750 */ 750 */
751 result = d_obtain_alias(inode); 751 result = d_obtain_alias(inode);
752 if (!IS_ERR(result)) 752 if (!IS_ERR(result))
753 result->d_op = sb->s_root->d_op; 753 d_set_d_op(result, sb->s_root->d_op);
754 return result; 754 return result;
755} 755}
756 756
@@ -800,7 +800,7 @@ static struct dentry *fat_get_parent(struct dentry *child)
800 800
801 parent = d_obtain_alias(inode); 801 parent = d_obtain_alias(inode);
802 if (!IS_ERR(parent)) 802 if (!IS_ERR(parent))
803 parent->d_op = sb->s_root->d_op; 803 d_set_d_op(parent, sb->s_root->d_op);
804out: 804out:
805 unlock_super(sb); 805 unlock_super(sb);
806 806
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 3b3e072d8982..35ffe43afa4b 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -227,10 +227,10 @@ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
227 } 227 }
228out: 228out:
229 unlock_super(sb); 229 unlock_super(sb);
230 dentry->d_op = &msdos_dentry_operations; 230 d_set_d_op(dentry, &msdos_dentry_operations);
231 dentry = d_splice_alias(inode, dentry); 231 dentry = d_splice_alias(inode, dentry);
232 if (dentry) 232 if (dentry)
233 dentry->d_op = &msdos_dentry_operations; 233 d_set_d_op(dentry, &msdos_dentry_operations);
234 return dentry; 234 return dentry;
235 235
236error: 236error:
@@ -673,7 +673,7 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent)
673 } 673 }
674 674
675 sb->s_flags |= MS_NOATIME; 675 sb->s_flags |= MS_NOATIME;
676 sb->s_root->d_op = &msdos_dentry_operations; 676 d_set_d_op(sb->s_root, &msdos_dentry_operations);
677 unlock_super(sb); 677 unlock_super(sb);
678 return 0; 678 return 0;
679} 679}
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 4fc06278db48..3be5ed7d859f 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -766,11 +766,11 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
766 766
767out: 767out:
768 unlock_super(sb); 768 unlock_super(sb);
769 dentry->d_op = sb->s_root->d_op; 769 d_set_d_op(dentry, sb->s_root->d_op);
770 dentry->d_time = dentry->d_parent->d_inode->i_version; 770 dentry->d_time = dentry->d_parent->d_inode->i_version;
771 dentry = d_splice_alias(inode, dentry); 771 dentry = d_splice_alias(inode, dentry);
772 if (dentry) { 772 if (dentry) {
773 dentry->d_op = sb->s_root->d_op; 773 d_set_d_op(dentry, sb->s_root->d_op);
774 dentry->d_time = dentry->d_parent->d_inode->i_version; 774 dentry->d_time = dentry->d_parent->d_inode->i_version;
775 } 775 }
776 return dentry; 776 return dentry;
@@ -1072,9 +1072,9 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent)
1072 } 1072 }
1073 1073
1074 if (MSDOS_SB(sb)->options.name_check != 's') 1074 if (MSDOS_SB(sb)->options.name_check != 's')
1075 sb->s_root->d_op = &vfat_ci_dentry_ops; 1075 d_set_d_op(sb->s_root, &vfat_ci_dentry_ops);
1076 else 1076 else
1077 sb->s_root->d_op = &vfat_dentry_ops; 1077 d_set_d_op(sb->s_root, &vfat_dentry_ops);
1078 1078
1079 unlock_super(sb); 1079 unlock_super(sb);
1080 return 0; 1080 return 0;