Merge branch 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / fs / dcache.c
index cab211e..d93872d 100644 (file)
@@ -103,14 +103,13 @@ EXPORT_SYMBOL(slash_name);
  * information, yet avoid using a prime hash-size or similar.
  */
 
-static unsigned int d_hash_mask __read_mostly;
 static unsigned int d_hash_shift __read_mostly;
 
 static struct hlist_bl_head *dentry_hashtable __read_mostly;
 
 static inline struct hlist_bl_head *d_hash(unsigned int hash)
 {
-       return dentry_hashtable + (hash >> (32 - d_hash_shift));
+       return dentry_hashtable + (hash >> d_hash_shift);
 }
 
 #define IN_LOOKUP_SHIFT 10
@@ -1642,8 +1641,7 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
        dname[name->len] = 0;
 
        /* Make sure we always see the terminating NUL character */
-       smp_wmb();
-       dentry->d_name.name = dname;
+       smp_store_release(&dentry->d_name.name, dname); /* ^^^ */
 
        dentry->d_lockref.count = 1;
        dentry->d_flags = 0;
@@ -3057,17 +3055,14 @@ static int prepend(char **buffer, int *buflen, const char *str, int namelen)
  * retry it again when a d_move() does happen. So any garbage in the buffer
  * due to mismatched pointer and length will be discarded.
  *
- * Data dependency barrier is needed to make sure that we see that terminating
- * NUL.  Alpha strikes again, film at 11...
+ * Load acquire is needed to make sure that we see that terminating NUL.
  */
 static int prepend_name(char **buffer, int *buflen, const struct qstr *name)
 {
-       const char *dname = READ_ONCE(name->name);
+       const char *dname = smp_load_acquire(&name->name); /* ^^^ */
        u32 dlen = READ_ONCE(name->len);
        char *p;
 
-       smp_read_barrier_depends();
-
        *buflen -= dlen + 1;
        if (*buflen < 0)
                return -ENAMETOOLONG;
@@ -3599,9 +3594,10 @@ static void __init dcache_init_early(void)
                                        13,
                                        HASH_EARLY | HASH_ZERO,
                                        &d_hash_shift,
-                                       &d_hash_mask,
+                                       NULL,
                                        0,
                                        0);
+       d_hash_shift = 32 - d_hash_shift;
 }
 
 static void __init dcache_init(void)
@@ -3625,9 +3621,10 @@ static void __init dcache_init(void)
                                        13,
                                        HASH_ZERO,
                                        &d_hash_shift,
-                                       &d_hash_mask,
+                                       NULL,
                                        0,
                                        0);
+       d_hash_shift = 32 - d_hash_shift;
 }
 
 /* SLAB cache for __getname() consumers */