Commit 665a7583 authored by Paul E. McKenney's avatar Paul E. McKenney Committed by Linus Torvalds

[PATCH] Remove hlist_for_each_rcu() API, convert existing use to hlist_for_each_entry_rcu

Remove the hlist_for_each_rcu() API, which is used only in one place, and
is trivially converted to hlist_for_each_entry_rcu(), making the code
shorter and more readable.  Any out-of-tree uses may be similarly
converted.
Signed-off-by: default avatar"Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9f46080c
...@@ -772,8 +772,6 @@ RCU pointer/list traversal: ...@@ -772,8 +772,6 @@ RCU pointer/list traversal:
list_for_each_entry_rcu list_for_each_entry_rcu
list_for_each_continue_rcu (to be deprecated in favor of new list_for_each_continue_rcu (to be deprecated in favor of new
list_for_each_entry_continue_rcu) list_for_each_entry_continue_rcu)
hlist_for_each_rcu (to be deprecated in favor of
hlist_for_each_entry_rcu)
hlist_for_each_entry_rcu hlist_for_each_entry_rcu
RCU pointer update: RCU pointer update:
......
...@@ -644,7 +644,7 @@ void shrink_dcache_parent(struct dentry * parent) ...@@ -644,7 +644,7 @@ void shrink_dcache_parent(struct dentry * parent)
* *
* Prune the dentries that are anonymous * Prune the dentries that are anonymous
* *
* parsing d_hash list does not hlist_for_each_rcu() as it * parsing d_hash list does not hlist_for_each_entry_rcu() as it
* done under dcache_lock. * done under dcache_lock.
* *
*/ */
...@@ -1043,15 +1043,13 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name) ...@@ -1043,15 +1043,13 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
struct hlist_head *head = d_hash(parent,hash); struct hlist_head *head = d_hash(parent,hash);
struct dentry *found = NULL; struct dentry *found = NULL;
struct hlist_node *node; struct hlist_node *node;
struct dentry *dentry;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_rcu(node, head) { hlist_for_each_entry_rcu(dentry, node, head, d_hash) {
struct dentry *dentry;
struct qstr *qstr; struct qstr *qstr;
dentry = hlist_entry(node, struct dentry, d_hash);
if (dentry->d_name.hash != hash) if (dentry->d_name.hash != hash)
continue; continue;
if (dentry->d_parent != parent) if (dentry->d_parent != parent)
...@@ -1123,7 +1121,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent) ...@@ -1123,7 +1121,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent)
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
base = d_hash(dparent, dentry->d_name.hash); base = d_hash(dparent, dentry->d_name.hash);
hlist_for_each(lhp,base) { hlist_for_each(lhp,base) {
/* hlist_for_each_rcu() not required for d_hash list /* hlist_for_each_entry_rcu() not required for d_hash list
* as it is parsed under dcache_lock * as it is parsed under dcache_lock
*/ */
if (dentry == hlist_entry(lhp, struct dentry, d_hash)) { if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {
......
...@@ -601,7 +601,7 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) ...@@ -601,7 +601,7 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
* or hlist_del_rcu(), running on this same list. * or hlist_del_rcu(), running on this same list.
* However, it is perfectly legal to run concurrently with * However, it is perfectly legal to run concurrently with
* the _rcu list-traversal primitives, such as * the _rcu list-traversal primitives, such as
* hlist_for_each_rcu(), used to prevent memory-consistency * hlist_for_each_entry_rcu(), used to prevent memory-consistency
* problems on Alpha CPUs. Regardless of the type of CPU, the * problems on Alpha CPUs. Regardless of the type of CPU, the
* list-traversal primitive must be guarded by rcu_read_lock(). * list-traversal primitive must be guarded by rcu_read_lock().
*/ */
...@@ -650,7 +650,7 @@ static inline void hlist_add_after(struct hlist_node *n, ...@@ -650,7 +650,7 @@ static inline void hlist_add_after(struct hlist_node *n,
* or hlist_del_rcu(), running on this same list. * or hlist_del_rcu(), running on this same list.
* However, it is perfectly legal to run concurrently with * However, it is perfectly legal to run concurrently with
* the _rcu list-traversal primitives, such as * the _rcu list-traversal primitives, such as
* hlist_for_each_rcu(), used to prevent memory-consistency * hlist_for_each_entry_rcu(), used to prevent memory-consistency
* problems on Alpha CPUs. * problems on Alpha CPUs.
*/ */
static inline void hlist_add_before_rcu(struct hlist_node *n, static inline void hlist_add_before_rcu(struct hlist_node *n,
...@@ -675,7 +675,7 @@ static inline void hlist_add_before_rcu(struct hlist_node *n, ...@@ -675,7 +675,7 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
* or hlist_del_rcu(), running on this same list. * or hlist_del_rcu(), running on this same list.
* However, it is perfectly legal to run concurrently with * However, it is perfectly legal to run concurrently with
* the _rcu list-traversal primitives, such as * the _rcu list-traversal primitives, such as
* hlist_for_each_rcu(), used to prevent memory-consistency * hlist_for_each_entry_rcu(), used to prevent memory-consistency
* problems on Alpha CPUs. * problems on Alpha CPUs.
*/ */
static inline void hlist_add_after_rcu(struct hlist_node *prev, static inline void hlist_add_after_rcu(struct hlist_node *prev,
...@@ -699,11 +699,6 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, ...@@ -699,11 +699,6 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
pos = n) pos = n)
#define hlist_for_each_rcu(pos, head) \
for ((pos) = (head)->first; \
rcu_dereference((pos)) && ({ prefetch((pos)->next); 1; }); \
(pos) = (pos)->next)
/** /**
* hlist_for_each_entry - iterate over list of given type * hlist_for_each_entry - iterate over list of given type
* @tpos: the type * to use as a loop counter. * @tpos: the type * to use as a loop counter.
...@@ -756,7 +751,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, ...@@ -756,7 +751,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
/** /**
* hlist_for_each_entry_rcu - iterate over rcu list of given type * hlist_for_each_entry_rcu - iterate over rcu list of given type
* @pos: the type * to use as a loop counter. * @tpos: the type * to use as a loop counter.
* @pos: the &struct hlist_node to use as a loop counter. * @pos: the &struct hlist_node to use as a loop counter.
* @head: the head for your list. * @head: the head for your list.
* @member: the name of the hlist_node within the struct. * @member: the name of the hlist_node within the struct.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment