summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-04-25 10:52:25 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-05-13 12:08:32 -0400
commit61fec493c9df7958f8417e1e2f6530a614ee619a (patch)
treec8df5c66a14064533dbd4081d81a25e36d1fb790 /fs/dcache.c
parent1c18d2a15ea4752c7a0d1aa6ef5659a744255140 (diff)
get rid of dead code in d_find_alias()
All "try disconnected alias if nothing else fits" logics in d_find_alias() got accidentally disabled by Neil a while ago; for most of the callers it was the right thing to do, so fixes belong in few callers that *do* want disconnected aliases. This just takes the now-dead code in d_find_alias() out. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c83
1 files changed, 34 insertions, 49 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 86d2de63461e..e9476e94372a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -907,6 +907,35 @@ repeat:
907} 907}
908EXPORT_SYMBOL(dget_parent); 908EXPORT_SYMBOL(dget_parent);
909 909
910static struct dentry * __d_find_any_alias(struct inode *inode)
911{
912 struct dentry *alias;
913
914 if (hlist_empty(&inode->i_dentry))
915 return NULL;
916 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
917 __dget(alias);
918 return alias;
919}
920
921/**
922 * d_find_any_alias - find any alias for a given inode
923 * @inode: inode to find an alias for
924 *
925 * If any aliases exist for the given inode, take and return a
926 * reference for one of them. If no aliases exist, return %NULL.
927 */
928struct dentry *d_find_any_alias(struct inode *inode)
929{
930 struct dentry *de;
931
932 spin_lock(&inode->i_lock);
933 de = __d_find_any_alias(inode);
934 spin_unlock(&inode->i_lock);
935 return de;
936}
937EXPORT_SYMBOL(d_find_any_alias);
938
910/** 939/**
911 * d_find_alias - grab a hashed alias of inode 940 * d_find_alias - grab a hashed alias of inode
912 * @inode: inode in question 941 * @inode: inode in question
@@ -923,34 +952,19 @@ EXPORT_SYMBOL(dget_parent);
923 */ 952 */
924static struct dentry *__d_find_alias(struct inode *inode) 953static struct dentry *__d_find_alias(struct inode *inode)
925{ 954{
926 struct dentry *alias, *discon_alias; 955 struct dentry *alias;
956
957 if (S_ISDIR(inode->i_mode))
958 return __d_find_any_alias(inode);
927 959
928again:
929 discon_alias = NULL;
930 hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) { 960 hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
931 spin_lock(&alias->d_lock); 961 spin_lock(&alias->d_lock);
932 if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) { 962 if (!d_unhashed(alias)) {
933 if (IS_ROOT(alias) &&
934 (alias->d_flags & DCACHE_DISCONNECTED)) {
935 discon_alias = alias;
936 } else {
937 __dget_dlock(alias);
938 spin_unlock(&alias->d_lock);
939 return alias;
940 }
941 }
942 spin_unlock(&alias->d_lock);
943 }
944 if (discon_alias) {
945 alias = discon_alias;
946 spin_lock(&alias->d_lock);
947 if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) {
948 __dget_dlock(alias); 963 __dget_dlock(alias);
949 spin_unlock(&alias->d_lock); 964 spin_unlock(&alias->d_lock);
950 return alias; 965 return alias;
951 } 966 }
952 spin_unlock(&alias->d_lock); 967 spin_unlock(&alias->d_lock);
953 goto again;
954 } 968 }
955 return NULL; 969 return NULL;
956} 970}
@@ -1941,35 +1955,6 @@ struct dentry *d_make_root(struct inode *root_inode)
1941} 1955}
1942EXPORT_SYMBOL(d_make_root); 1956EXPORT_SYMBOL(d_make_root);
1943 1957
1944static struct dentry * __d_find_any_alias(struct inode *inode)
1945{
1946 struct dentry *alias;
1947
1948 if (hlist_empty(&inode->i_dentry))
1949 return NULL;
1950 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
1951 __dget(alias);
1952 return alias;
1953}
1954
1955/**
1956 * d_find_any_alias - find any alias for a given inode
1957 * @inode: inode to find an alias for
1958 *
1959 * If any aliases exist for the given inode, take and return a
1960 * reference for one of them. If no aliases exist, return %NULL.
1961 */
1962struct dentry *d_find_any_alias(struct inode *inode)
1963{
1964 struct dentry *de;
1965
1966 spin_lock(&inode->i_lock);
1967 de = __d_find_any_alias(inode);
1968 spin_unlock(&inode->i_lock);
1969 return de;
1970}
1971EXPORT_SYMBOL(d_find_any_alias);
1972
1973static struct dentry *__d_instantiate_anon(struct dentry *dentry, 1958static struct dentry *__d_instantiate_anon(struct dentry *dentry,
1974 struct inode *inode, 1959 struct inode *inode,
1975 bool disconnected) 1960 bool disconnected)