aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDipankar Sarma <dipankar@in.ibm.com>2004-08-22 22:58:51 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-22 22:58:51 -0700
commit5dae7a69a46f3a9f6562a4702f8beaa7f77e94f6 (patch)
tree40daf62eb530c10372f9cb90f600a0b040c5e725 /fs
parent9711268caede0cbd322244d70145a6e914fac52e (diff)
downloadhistory-5dae7a69a46f3a9f6562a4702f8beaa7f77e94f6.tar.gz
[PATCH] rcu: abstracted RCU dereferencing
Use abstracted RCU API to dereference RCU protected data. Hides barrier details. Patch from Paul McKenney. This patch introduced an rcu_dereference() macro that replaces most uses of smp_read_barrier_depends(). The new macro has the advantage of explicitly documenting which pointers are protected by RCU -- in contrast, it is sometimes difficult to figure out which pointer is being protected by a given smp_read_barrier_depends() call. Signed-off-by: Paul McKenney <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 425c2e56894839..092323cf4646d5 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -613,7 +613,7 @@ void shrink_dcache_parent(struct dentry * parent)
*
* Prune the dentries that are anonymous
*
- * parsing d_hash list does not read_barrier_depends() as it
+ * parsing d_hash list does not hlist_for_each_rcu() as it
* done under dcache_lock.
*
*/
@@ -970,11 +970,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
rcu_read_lock();
- hlist_for_each (node, head) {
+ hlist_for_each_rcu(node, head) {
struct dentry *dentry;
struct qstr *qstr;
- smp_read_barrier_depends();
dentry = hlist_entry(node, struct dentry, d_hash);
smp_rmb();
@@ -1001,8 +1000,7 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
if (dentry->d_parent != parent)
goto next;
- qstr = &dentry->d_name;
- smp_read_barrier_depends();
+ qstr = rcu_dereference(&dentry->d_name);
if (parent->d_op && parent->d_op->d_compare) {
if (parent->d_op->d_compare(parent, qstr, name))
goto next;
@@ -1055,7 +1053,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent)
spin_lock(&dcache_lock);
base = d_hash(dparent, dentry->d_name.hash);
hlist_for_each(lhp,base) {
- /* read_barrier_depends() not required for d_hash list
+ /* hlist_for_each_rcu() not required for d_hash list
* as it is parsed under dcache_lock
*/
if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {