aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 16a53cc2cc02..138be96e25b6 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -104,7 +104,7 @@ static unsigned int d_hash_shift __read_mostly;
104 104
105static struct hlist_bl_head *dentry_hashtable __read_mostly; 105static struct hlist_bl_head *dentry_hashtable __read_mostly;
106 106
107static inline struct hlist_bl_head *d_hash(struct dentry *parent, 107static inline struct hlist_bl_head *d_hash(const struct dentry *parent,
108 unsigned long hash) 108 unsigned long hash)
109{ 109{
110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; 110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES;
@@ -1717,8 +1717,9 @@ EXPORT_SYMBOL(d_add_ci);
1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks 1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks
1718 * is formed, giving integrity down the path walk. 1718 * is formed, giving integrity down the path walk.
1719 */ 1719 */
1720struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 1720struct dentry *__d_lookup_rcu(const struct dentry *parent,
1721 unsigned *seq, struct inode **inode) 1721 const struct qstr *name,
1722 unsigned *seqp, struct inode **inode)
1722{ 1723{
1723 unsigned int len = name->len; 1724 unsigned int len = name->len;
1724 unsigned int hash = name->hash; 1725 unsigned int hash = name->hash;
@@ -1748,6 +1749,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
1748 * See Documentation/filesystems/path-lookup.txt for more details. 1749 * See Documentation/filesystems/path-lookup.txt for more details.
1749 */ 1750 */
1750 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { 1751 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) {
1752 unsigned seq;
1751 struct inode *i; 1753 struct inode *i;
1752 const char *tname; 1754 const char *tname;
1753 int tlen; 1755 int tlen;
@@ -1756,7 +1758,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
1756 continue; 1758 continue;
1757 1759
1758seqretry: 1760seqretry:
1759 *seq = read_seqcount_begin(&dentry->d_seq); 1761 seq = read_seqcount_begin(&dentry->d_seq);
1760 if (dentry->d_parent != parent) 1762 if (dentry->d_parent != parent)
1761 continue; 1763 continue;
1762 if (d_unhashed(dentry)) 1764 if (d_unhashed(dentry))
@@ -1771,7 +1773,7 @@ seqretry:
1771 * edge of memory when walking. If we could load this 1773 * edge of memory when walking. If we could load this
1772 * atomically some other way, we could drop this check. 1774 * atomically some other way, we could drop this check.
1773 */ 1775 */
1774 if (read_seqcount_retry(&dentry->d_seq, *seq)) 1776 if (read_seqcount_retry(&dentry->d_seq, seq))
1775 goto seqretry; 1777 goto seqretry;
1776 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) { 1778 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) {
1777 if (parent->d_op->d_compare(parent, *inode, 1779 if (parent->d_op->d_compare(parent, *inode,
@@ -1788,6 +1790,7 @@ seqretry:
1788 * order to do anything useful with the returned dentry 1790 * order to do anything useful with the returned dentry
1789 * anyway. 1791 * anyway.
1790 */ 1792 */
1793 *seqp = seq;
1791 *inode = i; 1794 *inode = i;
1792 return dentry; 1795 return dentry;
1793 } 1796 }
@@ -2968,7 +2971,7 @@ __setup("dhash_entries=", set_dhash_entries);
2968 2971
2969static void __init dcache_init_early(void) 2972static void __init dcache_init_early(void)
2970{ 2973{
2971 int loop; 2974 unsigned int loop;
2972 2975
2973 /* If hashes are distributed across NUMA nodes, defer 2976 /* If hashes are distributed across NUMA nodes, defer
2974 * hash allocation until vmalloc space is available. 2977 * hash allocation until vmalloc space is available.
@@ -2986,13 +2989,13 @@ static void __init dcache_init_early(void)
2986 &d_hash_mask, 2989 &d_hash_mask,
2987 0); 2990 0);
2988 2991
2989 for (loop = 0; loop < (1 << d_hash_shift); loop++) 2992 for (loop = 0; loop < (1U << d_hash_shift); loop++)
2990 INIT_HLIST_BL_HEAD(dentry_hashtable + loop); 2993 INIT_HLIST_BL_HEAD(dentry_hashtable + loop);
2991} 2994}
2992 2995
2993static void __init dcache_init(void) 2996static void __init dcache_init(void)
2994{ 2997{
2995 int loop; 2998 unsigned int loop;
2996 2999
2997 /* 3000 /*
2998 * A constructor could be added for stable state like the lists, 3001 * A constructor could be added for stable state like the lists,
@@ -3016,7 +3019,7 @@ static void __init dcache_init(void)
3016 &d_hash_mask, 3019 &d_hash_mask,
3017 0); 3020 0);
3018 3021
3019 for (loop = 0; loop < (1 << d_hash_shift); loop++) 3022 for (loop = 0; loop < (1U << d_hash_shift); loop++)
3020 INIT_HLIST_BL_HEAD(dentry_hashtable + loop); 3023 INIT_HLIST_BL_HEAD(dentry_hashtable + loop);
3021} 3024}
3022 3025