diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/adfs/dir.c | 2 | ||||
-rw-r--r-- | fs/affs/namei.c | 8 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 2 | ||||
-rw-r--r-- | fs/ceph/inode.c | 4 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 2 | ||||
-rw-r--r-- | fs/cifs/dir.c | 2 | ||||
-rw-r--r-- | fs/dcache.c | 23 | ||||
-rw-r--r-- | fs/efivarfs/super.c | 4 | ||||
-rw-r--r-- | fs/fat/namei_msdos.c | 2 | ||||
-rw-r--r-- | fs/fat/namei_vfat.c | 4 | ||||
-rw-r--r-- | fs/fuse/dev.c | 2 | ||||
-rw-r--r-- | fs/fuse/dir.c | 3 | ||||
-rw-r--r-- | fs/hfs/string.c | 2 | ||||
-rw-r--r-- | fs/hfsplus/unicode.c | 2 | ||||
-rw-r--r-- | fs/hpfs/dentry.c | 2 | ||||
-rw-r--r-- | fs/isofs/inode.c | 14 | ||||
-rw-r--r-- | fs/jffs2/dir.c | 8 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 2 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 2 | ||||
-rw-r--r-- | fs/jffs2/summary.c | 2 | ||||
-rw-r--r-- | fs/jffs2/write.c | 4 | ||||
-rw-r--r-- | fs/jfs/namei.c | 2 | ||||
-rw-r--r-- | fs/kernfs/dir.c | 4 | ||||
-rw-r--r-- | fs/logfs/dir.c | 6 | ||||
-rw-r--r-- | fs/namei.c | 42 | ||||
-rw-r--r-- | fs/ncpfs/dir.c | 2 | ||||
-rw-r--r-- | fs/nfs/dir.c | 4 | ||||
-rw-r--r-- | fs/ntfs/namei.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 2 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 2 | ||||
-rw-r--r-- | fs/sysv/namei.c | 2 |
31 files changed, 86 insertions, 78 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index fd4cf2c48e48..bec25f7017c0 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c | |||
@@ -207,7 +207,7 @@ adfs_hash(const struct dentry *parent, struct qstr *qstr) | |||
207 | */ | 207 | */ |
208 | qstr->len = i = name_len; | 208 | qstr->len = i = name_len; |
209 | name = qstr->name; | 209 | name = qstr->name; |
210 | hash = init_name_hash(); | 210 | hash = init_name_hash(parent); |
211 | while (i--) { | 211 | while (i--) { |
212 | char c; | 212 | char c; |
213 | 213 | ||
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 00d3002a6780..eb32029bc776 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -61,7 +61,7 @@ affs_get_toupper(struct super_block *sb) | |||
61 | * Note: the dentry argument is the parent dentry. | 61 | * Note: the dentry argument is the parent dentry. |
62 | */ | 62 | */ |
63 | static inline int | 63 | static inline int |
64 | __affs_hash_dentry(struct qstr *qstr, toupper_t toupper, bool notruncate) | 64 | __affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t toupper, bool notruncate) |
65 | { | 65 | { |
66 | const u8 *name = qstr->name; | 66 | const u8 *name = qstr->name; |
67 | unsigned long hash; | 67 | unsigned long hash; |
@@ -72,7 +72,7 @@ __affs_hash_dentry(struct qstr *qstr, toupper_t toupper, bool notruncate) | |||
72 | if (retval) | 72 | if (retval) |
73 | return retval; | 73 | return retval; |
74 | 74 | ||
75 | hash = init_name_hash(); | 75 | hash = init_name_hash(dentry); |
76 | len = min(qstr->len, AFFSNAMEMAX); | 76 | len = min(qstr->len, AFFSNAMEMAX); |
77 | for (; len > 0; name++, len--) | 77 | for (; len > 0; name++, len--) |
78 | hash = partial_name_hash(toupper(*name), hash); | 78 | hash = partial_name_hash(toupper(*name), hash); |
@@ -84,7 +84,7 @@ __affs_hash_dentry(struct qstr *qstr, toupper_t toupper, bool notruncate) | |||
84 | static int | 84 | static int |
85 | affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr) | 85 | affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr) |
86 | { | 86 | { |
87 | return __affs_hash_dentry(qstr, affs_toupper, | 87 | return __affs_hash_dentry(dentry, qstr, affs_toupper, |
88 | affs_nofilenametruncate(dentry)); | 88 | affs_nofilenametruncate(dentry)); |
89 | 89 | ||
90 | } | 90 | } |
@@ -92,7 +92,7 @@ affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr) | |||
92 | static int | 92 | static int |
93 | affs_intl_hash_dentry(const struct dentry *dentry, struct qstr *qstr) | 93 | affs_intl_hash_dentry(const struct dentry *dentry, struct qstr *qstr) |
94 | { | 94 | { |
95 | return __affs_hash_dentry(qstr, affs_intl_toupper, | 95 | return __affs_hash_dentry(dentry, qstr, affs_intl_toupper, |
96 | affs_nofilenametruncate(dentry)); | 96 | affs_nofilenametruncate(dentry)); |
97 | 97 | ||
98 | } | 98 | } |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 631f1554c87b..708214457d16 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -398,7 +398,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, | |||
398 | } | 398 | } |
399 | } | 399 | } |
400 | qstr.name = name; | 400 | qstr.name = name; |
401 | qstr.hash = full_name_hash(name, qstr.len); | 401 | qstr.hash = full_name_hash(dentry, name, qstr.len); |
402 | 402 | ||
403 | if (mutex_lock_interruptible(&sbi->wq_mutex)) { | 403 | if (mutex_lock_interruptible(&sbi->wq_mutex)) { |
404 | kfree(qstr.name); | 404 | kfree(qstr.name); |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index f059b5997072..99bdef66213a 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -1164,7 +1164,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1164 | 1164 | ||
1165 | dname.name = rinfo->dname; | 1165 | dname.name = rinfo->dname; |
1166 | dname.len = rinfo->dname_len; | 1166 | dname.len = rinfo->dname_len; |
1167 | dname.hash = full_name_hash(dname.name, dname.len); | 1167 | dname.hash = full_name_hash(parent, dname.name, dname.len); |
1168 | vino.ino = le64_to_cpu(rinfo->targeti.in->ino); | 1168 | vino.ino = le64_to_cpu(rinfo->targeti.in->ino); |
1169 | vino.snap = le64_to_cpu(rinfo->targeti.in->snapid); | 1169 | vino.snap = le64_to_cpu(rinfo->targeti.in->snapid); |
1170 | retry_lookup: | 1170 | retry_lookup: |
@@ -1508,7 +1508,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, | |||
1508 | 1508 | ||
1509 | dname.name = rde->name; | 1509 | dname.name = rde->name; |
1510 | dname.len = rde->name_len; | 1510 | dname.len = rde->name_len; |
1511 | dname.hash = full_name_hash(dname.name, dname.len); | 1511 | dname.hash = full_name_hash(parent, dname.name, dname.len); |
1512 | 1512 | ||
1513 | vino.ino = le64_to_cpu(rde->inode.in->ino); | 1513 | vino.ino = le64_to_cpu(rde->inode.in->ino); |
1514 | vino.snap = le64_to_cpu(rde->inode.in->snapid); | 1514 | vino.snap = le64_to_cpu(rde->inode.in->snapid); |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 2103b823bec0..4e8678a612b6 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -3204,7 +3204,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
3204 | WARN_ON(1); | 3204 | WARN_ON(1); |
3205 | goto release; /* hrm... */ | 3205 | goto release; /* hrm... */ |
3206 | } | 3206 | } |
3207 | dname.hash = full_name_hash(dname.name, dname.len); | 3207 | dname.hash = full_name_hash(parent, dname.name, dname.len); |
3208 | dentry = d_lookup(parent, &dname); | 3208 | dentry = d_lookup(parent, &dname); |
3209 | dput(parent); | 3209 | dput(parent); |
3210 | if (!dentry) | 3210 | if (!dentry) |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index fb0903fffc22..5efd6f1fb8a5 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -856,7 +856,7 @@ static int cifs_ci_hash(const struct dentry *dentry, struct qstr *q) | |||
856 | wchar_t c; | 856 | wchar_t c; |
857 | int i, charlen; | 857 | int i, charlen; |
858 | 858 | ||
859 | hash = init_name_hash(); | 859 | hash = init_name_hash(dentry); |
860 | for (i = 0; i < q->len; i += charlen) { | 860 | for (i = 0; i < q->len; i += charlen) { |
861 | charlen = codepage->char2uni(&q->name[i], q->len - i, &c); | 861 | charlen = codepage->char2uni(&q->name[i], q->len - i, &c); |
862 | /* error out if we can't convert the character */ | 862 | /* error out if we can't convert the character */ |
diff --git a/fs/dcache.c b/fs/dcache.c index d6847d7b123d..24bf27d66f6e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -104,11 +104,9 @@ static unsigned int d_hash_shift __read_mostly; | |||
104 | 104 | ||
105 | static struct hlist_bl_head *dentry_hashtable __read_mostly; | 105 | static struct hlist_bl_head *dentry_hashtable __read_mostly; |
106 | 106 | ||
107 | static inline struct hlist_bl_head *d_hash(const struct dentry *parent, | 107 | static inline struct hlist_bl_head *d_hash(unsigned int hash) |
108 | unsigned int hash) | ||
109 | { | 108 | { |
110 | hash += (unsigned long) parent / L1_CACHE_BYTES; | 109 | return dentry_hashtable + (hash >> (32 - d_hash_shift)); |
111 | return dentry_hashtable + hash_32(hash, d_hash_shift); | ||
112 | } | 110 | } |
113 | 111 | ||
114 | #define IN_LOOKUP_SHIFT 10 | 112 | #define IN_LOOKUP_SHIFT 10 |
@@ -488,7 +486,7 @@ void __d_drop(struct dentry *dentry) | |||
488 | if (unlikely(IS_ROOT(dentry))) | 486 | if (unlikely(IS_ROOT(dentry))) |
489 | b = &dentry->d_sb->s_anon; | 487 | b = &dentry->d_sb->s_anon; |
490 | else | 488 | else |
491 | b = d_hash(dentry->d_parent, dentry->d_name.hash); | 489 | b = d_hash(dentry->d_name.hash); |
492 | 490 | ||
493 | hlist_bl_lock(b); | 491 | hlist_bl_lock(b); |
494 | __hlist_bl_del(&dentry->d_hash); | 492 | __hlist_bl_del(&dentry->d_hash); |
@@ -1716,7 +1714,7 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name) | |||
1716 | struct qstr q; | 1714 | struct qstr q; |
1717 | 1715 | ||
1718 | q.name = name; | 1716 | q.name = name; |
1719 | q.hash_len = hashlen_string(name); | 1717 | q.hash_len = hashlen_string(parent, name); |
1720 | return d_alloc(parent, &q); | 1718 | return d_alloc(parent, &q); |
1721 | } | 1719 | } |
1722 | EXPORT_SYMBOL(d_alloc_name); | 1720 | EXPORT_SYMBOL(d_alloc_name); |
@@ -2140,7 +2138,7 @@ struct dentry *__d_lookup_rcu(const struct dentry *parent, | |||
2140 | { | 2138 | { |
2141 | u64 hashlen = name->hash_len; | 2139 | u64 hashlen = name->hash_len; |
2142 | const unsigned char *str = name->name; | 2140 | const unsigned char *str = name->name; |
2143 | struct hlist_bl_head *b = d_hash(parent, hashlen_hash(hashlen)); | 2141 | struct hlist_bl_head *b = d_hash(hashlen_hash(hashlen)); |
2144 | struct hlist_bl_node *node; | 2142 | struct hlist_bl_node *node; |
2145 | struct dentry *dentry; | 2143 | struct dentry *dentry; |
2146 | 2144 | ||
@@ -2257,7 +2255,7 @@ struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name) | |||
2257 | unsigned int len = name->len; | 2255 | unsigned int len = name->len; |
2258 | unsigned int hash = name->hash; | 2256 | unsigned int hash = name->hash; |
2259 | const unsigned char *str = name->name; | 2257 | const unsigned char *str = name->name; |
2260 | struct hlist_bl_head *b = d_hash(parent, hash); | 2258 | struct hlist_bl_head *b = d_hash(hash); |
2261 | struct hlist_bl_node *node; | 2259 | struct hlist_bl_node *node; |
2262 | struct dentry *found = NULL; | 2260 | struct dentry *found = NULL; |
2263 | struct dentry *dentry; | 2261 | struct dentry *dentry; |
@@ -2337,7 +2335,7 @@ struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) | |||
2337 | * calculate the standard hash first, as the d_op->d_hash() | 2335 | * calculate the standard hash first, as the d_op->d_hash() |
2338 | * routine may choose to leave the hash value unchanged. | 2336 | * routine may choose to leave the hash value unchanged. |
2339 | */ | 2337 | */ |
2340 | name->hash = full_name_hash(name->name, name->len); | 2338 | name->hash = full_name_hash(dir, name->name, name->len); |
2341 | if (dir->d_flags & DCACHE_OP_HASH) { | 2339 | if (dir->d_flags & DCACHE_OP_HASH) { |
2342 | int err = dir->d_op->d_hash(dir, name); | 2340 | int err = dir->d_op->d_hash(dir, name); |
2343 | if (unlikely(err < 0)) | 2341 | if (unlikely(err < 0)) |
@@ -2410,7 +2408,7 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) | |||
2410 | 2408 | ||
2411 | static void _d_rehash(struct dentry * entry) | 2409 | static void _d_rehash(struct dentry * entry) |
2412 | { | 2410 | { |
2413 | __d_rehash(entry, d_hash(entry->d_parent, entry->d_name.hash)); | 2411 | __d_rehash(entry, d_hash(entry->d_name.hash)); |
2414 | } | 2412 | } |
2415 | 2413 | ||
2416 | /** | 2414 | /** |
@@ -2874,7 +2872,7 @@ static void __d_move(struct dentry *dentry, struct dentry *target, | |||
2874 | * for the same hash queue because of how unlikely it is. | 2872 | * for the same hash queue because of how unlikely it is. |
2875 | */ | 2873 | */ |
2876 | __d_drop(dentry); | 2874 | __d_drop(dentry); |
2877 | __d_rehash(dentry, d_hash(target->d_parent, target->d_name.hash)); | 2875 | __d_rehash(dentry, d_hash(target->d_name.hash)); |
2878 | 2876 | ||
2879 | /* | 2877 | /* |
2880 | * Unhash the target (d_delete() is not usable here). If exchanging | 2878 | * Unhash the target (d_delete() is not usable here). If exchanging |
@@ -2882,8 +2880,7 @@ static void __d_move(struct dentry *dentry, struct dentry *target, | |||
2882 | */ | 2880 | */ |
2883 | __d_drop(target); | 2881 | __d_drop(target); |
2884 | if (exchange) { | 2882 | if (exchange) { |
2885 | __d_rehash(target, | 2883 | __d_rehash(target, d_hash(dentry->d_name.hash)); |
2886 | d_hash(dentry->d_parent, dentry->d_name.hash)); | ||
2887 | } | 2884 | } |
2888 | 2885 | ||
2889 | /* Switch the names.. */ | 2886 | /* Switch the names.. */ |
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 9cb54a38832d..a5e607e8f056 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
@@ -65,7 +65,7 @@ static int efivarfs_d_compare(const struct dentry *parent, | |||
65 | 65 | ||
66 | static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) | 66 | static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) |
67 | { | 67 | { |
68 | unsigned long hash = init_name_hash(); | 68 | unsigned long hash = init_name_hash(dentry); |
69 | const unsigned char *s = qstr->name; | 69 | const unsigned char *s = qstr->name; |
70 | unsigned int len = qstr->len; | 70 | unsigned int len = qstr->len; |
71 | 71 | ||
@@ -98,7 +98,7 @@ static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) | |||
98 | q.name = name; | 98 | q.name = name; |
99 | q.len = strlen(name); | 99 | q.len = strlen(name); |
100 | 100 | ||
101 | err = efivarfs_d_hash(NULL, &q); | 101 | err = efivarfs_d_hash(parent, &q); |
102 | if (err) | 102 | if (err) |
103 | return ERR_PTR(err); | 103 | return ERR_PTR(err); |
104 | 104 | ||
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index b7e2b33aa793..1337c0c7527d 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -154,7 +154,7 @@ static int msdos_hash(const struct dentry *dentry, struct qstr *qstr) | |||
154 | 154 | ||
155 | error = msdos_format_name(qstr->name, qstr->len, msdos_name, options); | 155 | error = msdos_format_name(qstr->name, qstr->len, msdos_name, options); |
156 | if (!error) | 156 | if (!error) |
157 | qstr->hash = full_name_hash(msdos_name, MSDOS_NAME); | 157 | qstr->hash = full_name_hash(dentry, msdos_name, MSDOS_NAME); |
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 7092584f424a..6ccdf3f34f90 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -107,7 +107,7 @@ static unsigned int vfat_striptail_len(const struct qstr *qstr) | |||
107 | */ | 107 | */ |
108 | static int vfat_hash(const struct dentry *dentry, struct qstr *qstr) | 108 | static int vfat_hash(const struct dentry *dentry, struct qstr *qstr) |
109 | { | 109 | { |
110 | qstr->hash = full_name_hash(qstr->name, vfat_striptail_len(qstr)); | 110 | qstr->hash = full_name_hash(dentry, qstr->name, vfat_striptail_len(qstr)); |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
@@ -127,7 +127,7 @@ static int vfat_hashi(const struct dentry *dentry, struct qstr *qstr) | |||
127 | name = qstr->name; | 127 | name = qstr->name; |
128 | len = vfat_striptail_len(qstr); | 128 | len = vfat_striptail_len(qstr); |
129 | 129 | ||
130 | hash = init_name_hash(); | 130 | hash = init_name_hash(dentry); |
131 | while (len--) | 131 | while (len--) |
132 | hash = partial_name_hash(nls_tolower(t, *name++), hash); | 132 | hash = partial_name_hash(nls_tolower(t, *name++), hash); |
133 | qstr->hash = end_name_hash(hash); | 133 | qstr->hash = end_name_hash(hash); |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index cbece1221417..203adf3b75db 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -1525,7 +1525,6 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, | |||
1525 | goto err; | 1525 | goto err; |
1526 | fuse_copy_finish(cs); | 1526 | fuse_copy_finish(cs); |
1527 | buf[outarg.namelen] = 0; | 1527 | buf[outarg.namelen] = 0; |
1528 | name.hash = full_name_hash(name.name, name.len); | ||
1529 | 1528 | ||
1530 | down_read(&fc->killsb); | 1529 | down_read(&fc->killsb); |
1531 | err = -ENOENT; | 1530 | err = -ENOENT; |
@@ -1576,7 +1575,6 @@ static int fuse_notify_delete(struct fuse_conn *fc, unsigned int size, | |||
1576 | goto err; | 1575 | goto err; |
1577 | fuse_copy_finish(cs); | 1576 | fuse_copy_finish(cs); |
1578 | buf[outarg.namelen] = 0; | 1577 | buf[outarg.namelen] = 0; |
1579 | name.hash = full_name_hash(name.name, name.len); | ||
1580 | 1578 | ||
1581 | down_read(&fc->killsb); | 1579 | down_read(&fc->killsb); |
1582 | err = -ENOENT; | 1580 | err = -ENOENT; |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index cca7b048c07b..5f1627725791 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -955,6 +955,7 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
955 | if (!dir) | 955 | if (!dir) |
956 | goto unlock; | 956 | goto unlock; |
957 | 957 | ||
958 | name->hash = full_name_hash(dir, name->name, name->len); | ||
958 | entry = d_lookup(dir, name); | 959 | entry = d_lookup(dir, name); |
959 | dput(dir); | 960 | dput(dir); |
960 | if (!entry) | 961 | if (!entry) |
@@ -1204,7 +1205,7 @@ static int fuse_direntplus_link(struct file *file, | |||
1204 | 1205 | ||
1205 | fc = get_fuse_conn(dir); | 1206 | fc = get_fuse_conn(dir); |
1206 | 1207 | ||
1207 | name.hash = full_name_hash(name.name, name.len); | 1208 | name.hash = full_name_hash(parent, name.name, name.len); |
1208 | dentry = d_lookup(parent, &name); | 1209 | dentry = d_lookup(parent, &name); |
1209 | if (!dentry) { | 1210 | if (!dentry) { |
1210 | retry: | 1211 | retry: |
diff --git a/fs/hfs/string.c b/fs/hfs/string.c index 85b610c3909f..ec9f164c35a5 100644 --- a/fs/hfs/string.c +++ b/fs/hfs/string.c | |||
@@ -59,7 +59,7 @@ int hfs_hash_dentry(const struct dentry *dentry, struct qstr *this) | |||
59 | if (len > HFS_NAMELEN) | 59 | if (len > HFS_NAMELEN) |
60 | len = HFS_NAMELEN; | 60 | len = HFS_NAMELEN; |
61 | 61 | ||
62 | hash = init_name_hash(); | 62 | hash = init_name_hash(dentry); |
63 | for (; len; len--) | 63 | for (; len; len--) |
64 | hash = partial_name_hash(caseorder[*name++], hash); | 64 | hash = partial_name_hash(caseorder[*name++], hash); |
65 | this->hash = end_name_hash(hash); | 65 | this->hash = end_name_hash(hash); |
diff --git a/fs/hfsplus/unicode.c b/fs/hfsplus/unicode.c index e8ef121a4d8b..c13c8a240be3 100644 --- a/fs/hfsplus/unicode.c +++ b/fs/hfsplus/unicode.c | |||
@@ -346,7 +346,7 @@ int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str) | |||
346 | 346 | ||
347 | casefold = test_bit(HFSPLUS_SB_CASEFOLD, &HFSPLUS_SB(sb)->flags); | 347 | casefold = test_bit(HFSPLUS_SB_CASEFOLD, &HFSPLUS_SB(sb)->flags); |
348 | decompose = !test_bit(HFSPLUS_SB_NODECOMPOSE, &HFSPLUS_SB(sb)->flags); | 348 | decompose = !test_bit(HFSPLUS_SB_NODECOMPOSE, &HFSPLUS_SB(sb)->flags); |
349 | hash = init_name_hash(); | 349 | hash = init_name_hash(dentry); |
350 | astr = str->name; | 350 | astr = str->name; |
351 | len = str->len; | 351 | len = str->len; |
352 | while (len > 0) { | 352 | while (len > 0) { |
diff --git a/fs/hpfs/dentry.c b/fs/hpfs/dentry.c index fa27980f2229..60e6d334d79a 100644 --- a/fs/hpfs/dentry.c +++ b/fs/hpfs/dentry.c | |||
@@ -26,7 +26,7 @@ static int hpfs_hash_dentry(const struct dentry *dentry, struct qstr *qstr) | |||
26 | /*return -ENOENT;*/ | 26 | /*return -ENOENT;*/ |
27 | x: | 27 | x: |
28 | 28 | ||
29 | hash = init_name_hash(); | 29 | hash = init_name_hash(dentry); |
30 | for (i = 0; i < l; i++) | 30 | for (i = 0; i < l; i++) |
31 | hash = partial_name_hash(hpfs_upcase(hpfs_sb(dentry->d_sb)->sb_cp_table,qstr->name[i]), hash); | 31 | hash = partial_name_hash(hpfs_upcase(hpfs_sb(dentry->d_sb)->sb_cp_table,qstr->name[i]), hash); |
32 | qstr->hash = end_name_hash(hash); | 32 | qstr->hash = end_name_hash(hash); |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 131dedc920d8..761fade7680f 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -174,7 +174,7 @@ struct iso9660_options{ | |||
174 | * Compute the hash for the isofs name corresponding to the dentry. | 174 | * Compute the hash for the isofs name corresponding to the dentry. |
175 | */ | 175 | */ |
176 | static int | 176 | static int |
177 | isofs_hashi_common(struct qstr *qstr, int ms) | 177 | isofs_hashi_common(const struct dentry *dentry, struct qstr *qstr, int ms) |
178 | { | 178 | { |
179 | const char *name; | 179 | const char *name; |
180 | int len; | 180 | int len; |
@@ -188,7 +188,7 @@ isofs_hashi_common(struct qstr *qstr, int ms) | |||
188 | len--; | 188 | len--; |
189 | } | 189 | } |
190 | 190 | ||
191 | hash = init_name_hash(); | 191 | hash = init_name_hash(dentry); |
192 | while (len--) { | 192 | while (len--) { |
193 | c = tolower(*name++); | 193 | c = tolower(*name++); |
194 | hash = partial_name_hash(c, hash); | 194 | hash = partial_name_hash(c, hash); |
@@ -231,7 +231,7 @@ static int isofs_dentry_cmp_common( | |||
231 | static int | 231 | static int |
232 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) | 232 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) |
233 | { | 233 | { |
234 | return isofs_hashi_common(qstr, 0); | 234 | return isofs_hashi_common(dentry, qstr, 0); |
235 | } | 235 | } |
236 | 236 | ||
237 | static int | 237 | static int |
@@ -246,7 +246,7 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, | |||
246 | * Compute the hash for the isofs name corresponding to the dentry. | 246 | * Compute the hash for the isofs name corresponding to the dentry. |
247 | */ | 247 | */ |
248 | static int | 248 | static int |
249 | isofs_hash_common(struct qstr *qstr, int ms) | 249 | isofs_hash_common(const struct dentry *dentry, struct qstr *qstr, int ms) |
250 | { | 250 | { |
251 | const char *name; | 251 | const char *name; |
252 | int len; | 252 | int len; |
@@ -258,7 +258,7 @@ isofs_hash_common(struct qstr *qstr, int ms) | |||
258 | len--; | 258 | len--; |
259 | } | 259 | } |
260 | 260 | ||
261 | qstr->hash = full_name_hash(name, len); | 261 | qstr->hash = full_name_hash(dentry, name, len); |
262 | 262 | ||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
@@ -266,13 +266,13 @@ isofs_hash_common(struct qstr *qstr, int ms) | |||
266 | static int | 266 | static int |
267 | isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) | 267 | isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) |
268 | { | 268 | { |
269 | return isofs_hash_common(qstr, 1); | 269 | return isofs_hash_common(dentry, qstr, 1); |
270 | } | 270 | } |
271 | 271 | ||
272 | static int | 272 | static int |
273 | isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr) | 273 | isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr) |
274 | { | 274 | { |
275 | return isofs_hashi_common(qstr, 1); | 275 | return isofs_hashi_common(dentry, qstr, 1); |
276 | } | 276 | } |
277 | 277 | ||
278 | static int | 278 | static int |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 84c4bf3631a2..30eb33ff8189 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -81,6 +81,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
81 | struct jffs2_full_dirent *fd = NULL, *fd_list; | 81 | struct jffs2_full_dirent *fd = NULL, *fd_list; |
82 | uint32_t ino = 0; | 82 | uint32_t ino = 0; |
83 | struct inode *inode = NULL; | 83 | struct inode *inode = NULL; |
84 | unsigned int nhash; | ||
84 | 85 | ||
85 | jffs2_dbg(1, "jffs2_lookup()\n"); | 86 | jffs2_dbg(1, "jffs2_lookup()\n"); |
86 | 87 | ||
@@ -89,11 +90,14 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
89 | 90 | ||
90 | dir_f = JFFS2_INODE_INFO(dir_i); | 91 | dir_f = JFFS2_INODE_INFO(dir_i); |
91 | 92 | ||
93 | /* The 'nhash' on the fd_list is not the same as the dentry hash */ | ||
94 | nhash = full_name_hash(NULL, target->d_name.name, target->d_name.len); | ||
95 | |||
92 | mutex_lock(&dir_f->sem); | 96 | mutex_lock(&dir_f->sem); |
93 | 97 | ||
94 | /* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */ | 98 | /* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */ |
95 | for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= target->d_name.hash; fd_list = fd_list->next) { | 99 | for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= nhash; fd_list = fd_list->next) { |
96 | if (fd_list->nhash == target->d_name.hash && | 100 | if (fd_list->nhash == nhash && |
97 | (!fd || fd_list->version > fd->version) && | 101 | (!fd || fd_list->version > fd->version) && |
98 | strlen(fd_list->name) == target->d_name.len && | 102 | strlen(fd_list->name) == target->d_name.len && |
99 | !strncmp(fd_list->name, target->d_name.name, target->d_name.len)) { | 103 | !strncmp(fd_list->name, target->d_name.name, target->d_name.len)) { |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index bfebbf13698c..06a71dbd4833 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -674,7 +674,7 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r | |||
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
677 | fd->nhash = full_name_hash(fd->name, rd->nsize); | 677 | fd->nhash = full_name_hash(NULL, fd->name, rd->nsize); |
678 | fd->next = NULL; | 678 | fd->next = NULL; |
679 | fd->name[rd->nsize] = '\0'; | 679 | fd->name[rd->nsize] = '\0'; |
680 | 680 | ||
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 9ad5ba4b299b..90431dd613b8 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -1100,7 +1100,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
1100 | fd->next = NULL; | 1100 | fd->next = NULL; |
1101 | fd->version = je32_to_cpu(rd->version); | 1101 | fd->version = je32_to_cpu(rd->version); |
1102 | fd->ino = je32_to_cpu(rd->ino); | 1102 | fd->ino = je32_to_cpu(rd->ino); |
1103 | fd->nhash = full_name_hash(fd->name, checkedlen); | 1103 | fd->nhash = full_name_hash(NULL, fd->name, checkedlen); |
1104 | fd->type = rd->type; | 1104 | fd->type = rd->type; |
1105 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); | 1105 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); |
1106 | 1106 | ||
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index bc5385471a6e..be7c8a6a5748 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -476,7 +476,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
476 | fd->next = NULL; | 476 | fd->next = NULL; |
477 | fd->version = je32_to_cpu(spd->version); | 477 | fd->version = je32_to_cpu(spd->version); |
478 | fd->ino = je32_to_cpu(spd->ino); | 478 | fd->ino = je32_to_cpu(spd->ino); |
479 | fd->nhash = full_name_hash(fd->name, checkedlen); | 479 | fd->nhash = full_name_hash(NULL, fd->name, checkedlen); |
480 | fd->type = spd->type; | 480 | fd->type = spd->type; |
481 | 481 | ||
482 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); | 482 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); |
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index 7fb187ab2682..cda9a361368e 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -245,7 +245,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
245 | 245 | ||
246 | fd->version = je32_to_cpu(rd->version); | 246 | fd->version = je32_to_cpu(rd->version); |
247 | fd->ino = je32_to_cpu(rd->ino); | 247 | fd->ino = je32_to_cpu(rd->ino); |
248 | fd->nhash = full_name_hash(name, namelen); | 248 | fd->nhash = full_name_hash(NULL, name, namelen); |
249 | fd->type = rd->type; | 249 | fd->type = rd->type; |
250 | memcpy(fd->name, name, namelen); | 250 | memcpy(fd->name, name, namelen); |
251 | fd->name[namelen]=0; | 251 | fd->name[namelen]=0; |
@@ -598,7 +598,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
598 | jffs2_add_fd_to_list(c, fd, &dir_f->dents); | 598 | jffs2_add_fd_to_list(c, fd, &dir_f->dents); |
599 | mutex_unlock(&dir_f->sem); | 599 | mutex_unlock(&dir_f->sem); |
600 | } else { | 600 | } else { |
601 | uint32_t nhash = full_name_hash(name, namelen); | 601 | uint32_t nhash = full_name_hash(NULL, name, namelen); |
602 | 602 | ||
603 | fd = dir_f->dents; | 603 | fd = dir_f->dents; |
604 | /* We don't actually want to reserve any space, but we do | 604 | /* We don't actually want to reserve any space, but we do |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 539deddecbb0..04baf0dfc40c 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -1564,7 +1564,7 @@ static int jfs_ci_hash(const struct dentry *dir, struct qstr *this) | |||
1564 | unsigned long hash; | 1564 | unsigned long hash; |
1565 | int i; | 1565 | int i; |
1566 | 1566 | ||
1567 | hash = init_name_hash(); | 1567 | hash = init_name_hash(dir); |
1568 | for (i=0; i < this->len; i++) | 1568 | for (i=0; i < this->len; i++) |
1569 | hash = partial_name_hash(tolower(this->name[i]), hash); | 1569 | hash = partial_name_hash(tolower(this->name[i]), hash); |
1570 | this->hash = end_name_hash(hash); | 1570 | this->hash = end_name_hash(hash); |
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 8a652404eef6..e57174d43683 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -336,11 +336,11 @@ struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn) | |||
336 | */ | 336 | */ |
337 | static unsigned int kernfs_name_hash(const char *name, const void *ns) | 337 | static unsigned int kernfs_name_hash(const char *name, const void *ns) |
338 | { | 338 | { |
339 | unsigned long hash = init_name_hash(); | 339 | unsigned long hash = init_name_hash(ns); |
340 | unsigned int len = strlen(name); | 340 | unsigned int len = strlen(name); |
341 | while (len--) | 341 | while (len--) |
342 | hash = partial_name_hash(*name++, hash); | 342 | hash = partial_name_hash(*name++, hash); |
343 | hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31)); | 343 | hash = end_name_hash(hash); |
344 | hash &= 0x7fffffffU; | 344 | hash &= 0x7fffffffU; |
345 | /* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */ | 345 | /* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */ |
346 | if (hash < 2) | 346 | if (hash < 2) |
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index 2d5336bd4efd..bcd754d216bd 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c | |||
@@ -95,7 +95,7 @@ static int beyond_eof(struct inode *inode, loff_t bix) | |||
95 | * of each character and pick a prime nearby, preferably a bit-sparse | 95 | * of each character and pick a prime nearby, preferably a bit-sparse |
96 | * one. | 96 | * one. |
97 | */ | 97 | */ |
98 | static u32 hash_32(const char *s, int len, u32 seed) | 98 | static u32 logfs_hash_32(const char *s, int len, u32 seed) |
99 | { | 99 | { |
100 | u32 hash = seed; | 100 | u32 hash = seed; |
101 | int i; | 101 | int i; |
@@ -159,7 +159,7 @@ static struct page *logfs_get_dd_page(struct inode *dir, struct dentry *dentry) | |||
159 | struct qstr *name = &dentry->d_name; | 159 | struct qstr *name = &dentry->d_name; |
160 | struct page *page; | 160 | struct page *page; |
161 | struct logfs_disk_dentry *dd; | 161 | struct logfs_disk_dentry *dd; |
162 | u32 hash = hash_32(name->name, name->len, 0); | 162 | u32 hash = logfs_hash_32(name->name, name->len, 0); |
163 | pgoff_t index; | 163 | pgoff_t index; |
164 | int round; | 164 | int round; |
165 | 165 | ||
@@ -370,7 +370,7 @@ static int logfs_write_dir(struct inode *dir, struct dentry *dentry, | |||
370 | { | 370 | { |
371 | struct page *page; | 371 | struct page *page; |
372 | struct logfs_disk_dentry *dd; | 372 | struct logfs_disk_dentry *dd; |
373 | u32 hash = hash_32(dentry->d_name.name, dentry->d_name.len, 0); | 373 | u32 hash = logfs_hash_32(dentry->d_name.name, dentry->d_name.len, 0); |
374 | pgoff_t index; | 374 | pgoff_t index; |
375 | int round, err; | 375 | int round, err; |
376 | 376 | ||
diff --git a/fs/namei.c b/fs/namei.c index 70580ab1445c..7cb9be3e200a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1890,9 +1890,9 @@ static inline unsigned int fold_hash(unsigned long x, unsigned long y) | |||
1890 | * payload bytes, to match the way that hash_name() iterates until it | 1890 | * payload bytes, to match the way that hash_name() iterates until it |
1891 | * finds the delimiter after the name. | 1891 | * finds the delimiter after the name. |
1892 | */ | 1892 | */ |
1893 | unsigned int full_name_hash(const char *name, unsigned int len) | 1893 | unsigned int full_name_hash(const void *salt, const char *name, unsigned int len) |
1894 | { | 1894 | { |
1895 | unsigned long a, x = 0, y = 0; | 1895 | unsigned long a, x = 0, y = (unsigned long)salt; |
1896 | 1896 | ||
1897 | for (;;) { | 1897 | for (;;) { |
1898 | if (!len) | 1898 | if (!len) |
@@ -1911,15 +1911,19 @@ done: | |||
1911 | EXPORT_SYMBOL(full_name_hash); | 1911 | EXPORT_SYMBOL(full_name_hash); |
1912 | 1912 | ||
1913 | /* Return the "hash_len" (hash and length) of a null-terminated string */ | 1913 | /* Return the "hash_len" (hash and length) of a null-terminated string */ |
1914 | u64 hashlen_string(const char *name) | 1914 | u64 hashlen_string(const void *salt, const char *name) |
1915 | { | 1915 | { |
1916 | unsigned long a = 0, x = 0, y = 0, adata, mask, len; | 1916 | unsigned long a = 0, x = 0, y = (unsigned long)salt; |
1917 | unsigned long adata, mask, len; | ||
1917 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; | 1918 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
1918 | 1919 | ||
1919 | len = -sizeof(unsigned long); | 1920 | len = 0; |
1921 | goto inside; | ||
1922 | |||
1920 | do { | 1923 | do { |
1921 | HASH_MIX(x, y, a); | 1924 | HASH_MIX(x, y, a); |
1922 | len += sizeof(unsigned long); | 1925 | len += sizeof(unsigned long); |
1926 | inside: | ||
1923 | a = load_unaligned_zeropad(name+len); | 1927 | a = load_unaligned_zeropad(name+len); |
1924 | } while (!has_zero(a, &adata, &constants)); | 1928 | } while (!has_zero(a, &adata, &constants)); |
1925 | 1929 | ||
@@ -1935,15 +1939,19 @@ EXPORT_SYMBOL(hashlen_string); | |||
1935 | * Calculate the length and hash of the path component, and | 1939 | * Calculate the length and hash of the path component, and |
1936 | * return the "hash_len" as the result. | 1940 | * return the "hash_len" as the result. |
1937 | */ | 1941 | */ |
1938 | static inline u64 hash_name(const char *name) | 1942 | static inline u64 hash_name(const void *salt, const char *name) |
1939 | { | 1943 | { |
1940 | unsigned long a = 0, b, x = 0, y = 0, adata, bdata, mask, len; | 1944 | unsigned long a = 0, b, x = 0, y = (unsigned long)salt; |
1945 | unsigned long adata, bdata, mask, len; | ||
1941 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; | 1946 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
1942 | 1947 | ||
1943 | len = -sizeof(unsigned long); | 1948 | len = 0; |
1949 | goto inside; | ||
1950 | |||
1944 | do { | 1951 | do { |
1945 | HASH_MIX(x, y, a); | 1952 | HASH_MIX(x, y, a); |
1946 | len += sizeof(unsigned long); | 1953 | len += sizeof(unsigned long); |
1954 | inside: | ||
1947 | a = load_unaligned_zeropad(name+len); | 1955 | a = load_unaligned_zeropad(name+len); |
1948 | b = a ^ REPEAT_BYTE('/'); | 1956 | b = a ^ REPEAT_BYTE('/'); |
1949 | } while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants))); | 1957 | } while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants))); |
@@ -1959,9 +1967,9 @@ static inline u64 hash_name(const char *name) | |||
1959 | #else /* !CONFIG_DCACHE_WORD_ACCESS: Slow, byte-at-a-time version */ | 1967 | #else /* !CONFIG_DCACHE_WORD_ACCESS: Slow, byte-at-a-time version */ |
1960 | 1968 | ||
1961 | /* Return the hash of a string of known length */ | 1969 | /* Return the hash of a string of known length */ |
1962 | unsigned int full_name_hash(const char *name, unsigned int len) | 1970 | unsigned int full_name_hash(const void *salt, const char *name, unsigned int len) |
1963 | { | 1971 | { |
1964 | unsigned long hash = init_name_hash(); | 1972 | unsigned long hash = init_name_hash(salt); |
1965 | while (len--) | 1973 | while (len--) |
1966 | hash = partial_name_hash((unsigned char)*name++, hash); | 1974 | hash = partial_name_hash((unsigned char)*name++, hash); |
1967 | return end_name_hash(hash); | 1975 | return end_name_hash(hash); |
@@ -1969,9 +1977,9 @@ unsigned int full_name_hash(const char *name, unsigned int len) | |||
1969 | EXPORT_SYMBOL(full_name_hash); | 1977 | EXPORT_SYMBOL(full_name_hash); |
1970 | 1978 | ||
1971 | /* Return the "hash_len" (hash and length) of a null-terminated string */ | 1979 | /* Return the "hash_len" (hash and length) of a null-terminated string */ |
1972 | u64 hashlen_string(const char *name) | 1980 | u64 hashlen_string(const void *salt, const char *name) |
1973 | { | 1981 | { |
1974 | unsigned long hash = init_name_hash(); | 1982 | unsigned long hash = init_name_hash(salt); |
1975 | unsigned long len = 0, c; | 1983 | unsigned long len = 0, c; |
1976 | 1984 | ||
1977 | c = (unsigned char)*name; | 1985 | c = (unsigned char)*name; |
@@ -1988,9 +1996,9 @@ EXPORT_SYMBOL(hashlen_string); | |||
1988 | * We know there's a real path component here of at least | 1996 | * We know there's a real path component here of at least |
1989 | * one character. | 1997 | * one character. |
1990 | */ | 1998 | */ |
1991 | static inline u64 hash_name(const char *name) | 1999 | static inline u64 hash_name(const void *salt, const char *name) |
1992 | { | 2000 | { |
1993 | unsigned long hash = init_name_hash(); | 2001 | unsigned long hash = init_name_hash(salt); |
1994 | unsigned long len = 0, c; | 2002 | unsigned long len = 0, c; |
1995 | 2003 | ||
1996 | c = (unsigned char)*name; | 2004 | c = (unsigned char)*name; |
@@ -2030,7 +2038,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
2030 | if (err) | 2038 | if (err) |
2031 | return err; | 2039 | return err; |
2032 | 2040 | ||
2033 | hash_len = hash_name(name); | 2041 | hash_len = hash_name(nd->path.dentry, name); |
2034 | 2042 | ||
2035 | type = LAST_NORM; | 2043 | type = LAST_NORM; |
2036 | if (name[0] == '.') switch (hashlen_len(hash_len)) { | 2044 | if (name[0] == '.') switch (hashlen_len(hash_len)) { |
@@ -2436,7 +2444,7 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | |||
2436 | 2444 | ||
2437 | this.name = name; | 2445 | this.name = name; |
2438 | this.len = len; | 2446 | this.len = len; |
2439 | this.hash = full_name_hash(name, len); | 2447 | this.hash = full_name_hash(base, name, len); |
2440 | if (!len) | 2448 | if (!len) |
2441 | return ERR_PTR(-EACCES); | 2449 | return ERR_PTR(-EACCES); |
2442 | 2450 | ||
@@ -2489,7 +2497,7 @@ struct dentry *lookup_one_len_unlocked(const char *name, | |||
2489 | 2497 | ||
2490 | this.name = name; | 2498 | this.name = name; |
2491 | this.len = len; | 2499 | this.len = len; |
2492 | this.hash = full_name_hash(name, len); | 2500 | this.hash = full_name_hash(base, name, len); |
2493 | if (!len) | 2501 | if (!len) |
2494 | return ERR_PTR(-EACCES); | 2502 | return ERR_PTR(-EACCES); |
2495 | 2503 | ||
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index bfdad003ee56..9add7ab747a5 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -139,7 +139,7 @@ ncp_hash_dentry(const struct dentry *dentry, struct qstr *this) | |||
139 | int i; | 139 | int i; |
140 | 140 | ||
141 | t = NCP_IO_TABLE(sb); | 141 | t = NCP_IO_TABLE(sb); |
142 | hash = init_name_hash(); | 142 | hash = init_name_hash(dentry); |
143 | for (i=0; i<this->len ; i++) | 143 | for (i=0; i<this->len ; i++) |
144 | hash = partial_name_hash(ncp_tolower(t, this->name[i]), | 144 | hash = partial_name_hash(ncp_tolower(t, this->name[i]), |
145 | hash); | 145 | hash); |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 19d93d0cd400..411375f3c585 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -232,7 +232,7 @@ int nfs_readdir_make_qstr(struct qstr *string, const char *name, unsigned int le | |||
232 | * in a page cache page which kmemleak does not scan. | 232 | * in a page cache page which kmemleak does not scan. |
233 | */ | 233 | */ |
234 | kmemleak_not_leak(string->name); | 234 | kmemleak_not_leak(string->name); |
235 | string->hash = full_name_hash(name, len); | 235 | string->hash = full_name_hash(NULL, name, len); |
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
@@ -502,7 +502,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
502 | if (filename.len == 2 && filename.name[1] == '.') | 502 | if (filename.len == 2 && filename.name[1] == '.') |
503 | return; | 503 | return; |
504 | } | 504 | } |
505 | filename.hash = full_name_hash(filename.name, filename.len); | 505 | filename.hash = full_name_hash(parent, filename.name, filename.len); |
506 | 506 | ||
507 | dentry = d_lookup(parent, &filename); | 507 | dentry = d_lookup(parent, &filename); |
508 | again: | 508 | again: |
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index 443abecf01b7..358258364616 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c | |||
@@ -253,7 +253,7 @@ handle_name: | |||
253 | err = (signed)nls_name.len; | 253 | err = (signed)nls_name.len; |
254 | goto err_out; | 254 | goto err_out; |
255 | } | 255 | } |
256 | nls_name.hash = full_name_hash(nls_name.name, nls_name.len); | 256 | nls_name.hash = full_name_hash(dent, nls_name.name, nls_name.len); |
257 | 257 | ||
258 | dent = d_add_ci(dent, dent_inode, &nls_name); | 258 | dent = d_add_ci(dent, dent_inode, &nls_name); |
259 | kfree(nls_name.name); | 259 | kfree(nls_name.name); |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 004f2cbe8f71..8107d0d0c3f6 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -47,7 +47,7 @@ | |||
47 | #define DLM_HASH_BUCKETS (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE) | 47 | #define DLM_HASH_BUCKETS (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE) |
48 | 48 | ||
49 | /* Intended to make it easier for us to switch out hash functions */ | 49 | /* Intended to make it easier for us to switch out hash functions */ |
50 | #define dlm_lockid_hash(_n, _l) full_name_hash(_n, _l) | 50 | #define dlm_lockid_hash(_n, _l) full_name_hash(NULL, _n, _l) |
51 | 51 | ||
52 | enum dlm_mle_type { | 52 | enum dlm_mle_type { |
53 | DLM_MLE_BLOCK = 0, | 53 | DLM_MLE_BLOCK = 0, |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 5e57c3e46e1d..b59db94d2ff4 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -623,7 +623,7 @@ static bool proc_sys_fill_cache(struct file *file, | |||
623 | 623 | ||
624 | qname.name = table->procname; | 624 | qname.name = table->procname; |
625 | qname.len = strlen(table->procname); | 625 | qname.len = strlen(table->procname); |
626 | qname.hash = full_name_hash(qname.name, qname.len); | 626 | qname.hash = full_name_hash(dir, qname.name, qname.len); |
627 | 627 | ||
628 | child = d_lookup(dir, &qname); | 628 | child = d_lookup(dir, &qname); |
629 | if (!child) { | 629 | if (!child) { |
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index 90b60c03b588..a42de45ce40d 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
@@ -33,7 +33,7 @@ static int sysv_hash(const struct dentry *dentry, struct qstr *qstr) | |||
33 | function. */ | 33 | function. */ |
34 | if (qstr->len > SYSV_NAMELEN) { | 34 | if (qstr->len > SYSV_NAMELEN) { |
35 | qstr->len = SYSV_NAMELEN; | 35 | qstr->len = SYSV_NAMELEN; |
36 | qstr->hash = full_name_hash(qstr->name, qstr->len); | 36 | qstr->hash = full_name_hash(dentry, qstr->name, qstr->len); |
37 | } | 37 | } |
38 | return 0; | 38 | return 0; |
39 | } | 39 | } |