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>
This commit is contained in:
@@ -135,9 +135,9 @@ static void setup_cifs_dentry(struct cifsTconInfo *tcon,
|
||||
struct inode *newinode)
|
||||
{
|
||||
if (tcon->nocase)
|
||||
direntry->d_op = &cifs_ci_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_ci_dentry_ops);
|
||||
else
|
||||
direntry->d_op = &cifs_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_dentry_ops);
|
||||
d_instantiate(direntry, newinode);
|
||||
}
|
||||
|
||||
@@ -421,9 +421,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
|
||||
rc = cifs_get_inode_info_unix(&newinode, full_path,
|
||||
inode->i_sb, xid);
|
||||
if (pTcon->nocase)
|
||||
direntry->d_op = &cifs_ci_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_ci_dentry_ops);
|
||||
else
|
||||
direntry->d_op = &cifs_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_dentry_ops);
|
||||
|
||||
if (rc == 0)
|
||||
d_instantiate(direntry, newinode);
|
||||
@@ -604,9 +604,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
|
||||
|
||||
if ((rc == 0) && (newInode != NULL)) {
|
||||
if (pTcon->nocase)
|
||||
direntry->d_op = &cifs_ci_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_ci_dentry_ops);
|
||||
else
|
||||
direntry->d_op = &cifs_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_dentry_ops);
|
||||
d_add(direntry, newInode);
|
||||
if (posix_open) {
|
||||
filp = lookup_instantiate_filp(nd, direntry,
|
||||
@@ -634,9 +634,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
|
||||
rc = 0;
|
||||
direntry->d_time = jiffies;
|
||||
if (pTcon->nocase)
|
||||
direntry->d_op = &cifs_ci_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_ci_dentry_ops);
|
||||
else
|
||||
direntry->d_op = &cifs_dentry_ops;
|
||||
d_set_d_op(direntry, &cifs_dentry_ops);
|
||||
d_add(direntry, NULL);
|
||||
/* if it was once a directory (but how can we tell?) we could do
|
||||
shrink_dcache_parent(direntry); */
|
||||
|
Reference in New Issue
Block a user