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/configfs | |
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/configfs')
-rw-r--r-- | fs/configfs/dir.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index e9acea440ffc..36637a8c1ed3 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -442,7 +442,7 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den | |||
442 | return error; | 442 | return error; |
443 | } | 443 | } |
444 | 444 | ||
445 | dentry->d_op = &configfs_dentry_ops; | 445 | d_set_d_op(dentry, &configfs_dentry_ops); |
446 | d_rehash(dentry); | 446 | d_rehash(dentry); |
447 | 447 | ||
448 | return 0; | 448 | return 0; |
@@ -489,7 +489,7 @@ static struct dentry * configfs_lookup(struct inode *dir, | |||
489 | */ | 489 | */ |
490 | if (dentry->d_name.len > NAME_MAX) | 490 | if (dentry->d_name.len > NAME_MAX) |
491 | return ERR_PTR(-ENAMETOOLONG); | 491 | return ERR_PTR(-ENAMETOOLONG); |
492 | dentry->d_op = &configfs_dentry_ops; | 492 | d_set_d_op(dentry, &configfs_dentry_ops); |
493 | d_add(dentry, NULL); | 493 | d_add(dentry, NULL); |
494 | return NULL; | 494 | return NULL; |
495 | } | 495 | } |
@@ -683,7 +683,7 @@ static int create_default_group(struct config_group *parent_group, | |||
683 | ret = -ENOMEM; | 683 | ret = -ENOMEM; |
684 | child = d_alloc(parent, &name); | 684 | child = d_alloc(parent, &name); |
685 | if (child) { | 685 | if (child) { |
686 | child->d_op = &configfs_dentry_ops; | 686 | d_set_d_op(child, &configfs_dentry_ops); |
687 | d_add(child, NULL); | 687 | d_add(child, NULL); |
688 | 688 | ||
689 | ret = configfs_attach_group(&parent_group->cg_item, | 689 | ret = configfs_attach_group(&parent_group->cg_item, |
@@ -1681,7 +1681,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
1681 | err = -ENOMEM; | 1681 | err = -ENOMEM; |
1682 | dentry = d_alloc(configfs_sb->s_root, &name); | 1682 | dentry = d_alloc(configfs_sb->s_root, &name); |
1683 | if (dentry) { | 1683 | if (dentry) { |
1684 | dentry->d_op = &configfs_dentry_ops; | 1684 | d_set_d_op(dentry, &configfs_dentry_ops); |
1685 | d_add(dentry, NULL); | 1685 | d_add(dentry, NULL); |
1686 | 1686 | ||
1687 | err = configfs_attach_group(sd->s_element, &group->cg_item, | 1687 | err = configfs_attach_group(sd->s_element, &group->cg_item, |