diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-08-13 10:27:43 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:44 -0500 |
commit | 3cac260ad88f4e37637d6e4b33e6a6a849d273c7 (patch) | |
tree | 2cde342e32fccadfcc900c10b4a8e49398fb24cf /fs/namei.c | |
parent | e9496ff46a20a8592fdc7bdaaf41b45eb808d310 (diff) |
Take hash recalculation into do_lookup()
Both callers of do_lookup() do the same thing before it
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/fs/namei.c b/fs/namei.c index 89e380583ab..6ce27d6db68 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -767,8 +767,18 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, | |||
767 | struct path *path) | 767 | struct path *path) |
768 | { | 768 | { |
769 | struct vfsmount *mnt = nd->path.mnt; | 769 | struct vfsmount *mnt = nd->path.mnt; |
770 | struct dentry *dentry = __d_lookup(nd->path.dentry, name); | 770 | struct dentry *dentry; |
771 | /* | ||
772 | * See if the low-level filesystem might want | ||
773 | * to use its own hash.. | ||
774 | */ | ||
775 | if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { | ||
776 | int err = nd->path.dentry->d_op->d_hash(nd->path.dentry, name); | ||
777 | if (err < 0) | ||
778 | return err; | ||
779 | } | ||
771 | 780 | ||
781 | dentry = __d_lookup(nd->path.dentry, name); | ||
772 | if (!dentry) | 782 | if (!dentry) |
773 | goto need_lookup; | 783 | goto need_lookup; |
774 | if (dentry->d_op && dentry->d_op->d_revalidate) | 784 | if (dentry->d_op && dentry->d_op->d_revalidate) |
@@ -868,16 +878,6 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
868 | case 1: | 878 | case 1: |
869 | continue; | 879 | continue; |
870 | } | 880 | } |
871 | /* | ||
872 | * See if the low-level filesystem might want | ||
873 | * to use its own hash.. | ||
874 | */ | ||
875 | if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { | ||
876 | err = nd->path.dentry->d_op->d_hash(nd->path.dentry, | ||
877 | &this); | ||
878 | if (err < 0) | ||
879 | break; | ||
880 | } | ||
881 | /* This does the actual lookups.. */ | 881 | /* This does the actual lookups.. */ |
882 | err = do_lookup(nd, &this, &next); | 882 | err = do_lookup(nd, &this, &next); |
883 | if (err) | 883 | if (err) |
@@ -923,12 +923,6 @@ last_component: | |||
923 | case 1: | 923 | case 1: |
924 | goto return_reval; | 924 | goto return_reval; |
925 | } | 925 | } |
926 | if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { | ||
927 | err = nd->path.dentry->d_op->d_hash(nd->path.dentry, | ||
928 | &this); | ||
929 | if (err < 0) | ||
930 | break; | ||
931 | } | ||
932 | err = do_lookup(nd, &this, &next); | 926 | err = do_lookup(nd, &this, &next); |
933 | if (err) | 927 | if (err) |
934 | break; | 928 | break; |