public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, dipankar@in.ibm.com, manfred@colorfullife.com,
	maneesh@in.ibm.com, erikj@sgi.com, ak@suse.de
Subject: [PATCH 2/2] Remove hlist_for_each_rcu() API, convert existing use to hlist_for_each_entry_rcu
Date: Fri, 28 Oct 2005 20:07:36 -0700	[thread overview]
Message-ID: <20051029030736.GA26923@us.ibm.com> (raw)
In-Reply-To: <20051029025907.GA26879@us.ibm.com>

Hello!

This patch removes 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: <paulmck@us.ibm.com>

---

 Documentation/RCU/whatisRCU.txt |    2 --
 fs/dcache.c                     |   10 ++++------
 include/linux/list.h            |   13 ++++---------
 3 files changed, 8 insertions(+), 17 deletions(-)

diff -urpNa -X dontdiff linux-2.6.14-RCUdoc/Documentation/RCU/whatisRCU.txt linux-2.6.14-kill-hlist_for_each_rcu/Documentation/RCU/whatisRCU.txt
--- linux-2.6.14-RCUdoc/Documentation/RCU/whatisRCU.txt	2005-10-28 14:40:47.000000000 -0700
+++ linux-2.6.14-kill-hlist_for_each_rcu/Documentation/RCU/whatisRCU.txt	2005-10-28 17:29:10.000000000 -0700
@@ -771,8 +771,6 @@ RCU pointer/list traversal:
 	list_for_each_entry_rcu
 	list_for_each_continue_rcu	(to be deprecated in favor of new
 					 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
 
 RCU pointer update:
diff -urpNa -X dontdiff linux-2.6.14-RCUdoc/fs/dcache.c linux-2.6.14-kill-hlist_for_each_rcu/fs/dcache.c
--- linux-2.6.14-RCUdoc/fs/dcache.c	2005-10-27 17:02:08.000000000 -0700
+++ linux-2.6.14-kill-hlist_for_each_rcu/fs/dcache.c	2005-10-28 17:34:01.000000000 -0700
@@ -644,7 +644,7 @@ void shrink_dcache_parent(struct dentry 
  *
  * 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.
  *
  */
@@ -1043,15 +1043,13 @@ struct dentry * __d_lookup(struct dentry
 	struct hlist_head *head = d_hash(parent,hash);
 	struct dentry *found = NULL;
 	struct hlist_node *node;
+	struct dentry *dentry; 
 
 	rcu_read_lock();
 	
-	hlist_for_each_rcu(node, head) {
-		struct dentry *dentry; 
+	hlist_for_each_entry_rcu(dentry, node, head, d_hash) {
 		struct qstr *qstr;
 
-		dentry = hlist_entry(node, struct dentry, d_hash);
-
 		if (dentry->d_name.hash != hash)
 			continue;
 		if (dentry->d_parent != parent)
@@ -1123,7 +1121,7 @@ int d_validate(struct dentry *dentry, st
 	spin_lock(&dcache_lock);
 	base = d_hash(dparent, dentry->d_name.hash);
 	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
 		 */
 		if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {
diff -urpNa -X dontdiff linux-2.6.14-RCUdoc/include/linux/list.h linux-2.6.14-kill-hlist_for_each_rcu/include/linux/list.h
--- linux-2.6.14-RCUdoc/include/linux/list.h	2005-10-28 14:40:52.000000000 -0700
+++ linux-2.6.14-kill-hlist_for_each_rcu/include/linux/list.h	2005-10-28 17:30:18.000000000 -0700
@@ -585,7 +585,7 @@ static inline void hlist_add_head(struct
  * or hlist_del_rcu(), running on this same list.
  * However, it is perfectly legal to run concurrently with
  * 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
  * list-traversal primitive must be guarded by rcu_read_lock().
  */
@@ -634,7 +634,7 @@ static inline void hlist_add_after(struc
  * or hlist_del_rcu(), running on this same list.
  * However, it is perfectly legal to run concurrently with
  * 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.
  */
 static inline void hlist_add_before_rcu(struct hlist_node *n,
@@ -659,7 +659,7 @@ static inline void hlist_add_before_rcu(
  * or hlist_del_rcu(), running on this same list.
  * However, it is perfectly legal to run concurrently with
  * 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.
  */
 static inline void hlist_add_after_rcu(struct hlist_node *prev,
@@ -683,11 +683,6 @@ static inline void hlist_add_after_rcu(s
 	for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
 	     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
  * @tpos:	the type * to use as a loop counter.
@@ -740,7 +735,7 @@ static inline void hlist_add_after_rcu(s
 
 /**
  * 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.
  * @head:	the head for your list.
  * @member:	the name of the hlist_node within the struct.

      reply	other threads:[~2005-10-29  3:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-29  2:59 [PATCH 1/2] Remove unused list_for_each_safe_rcu() API Paul E. McKenney
2005-10-29  3:07 ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051029030736.GA26923@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=dipankar@in.ibm.com \
    --cc=erikj@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=manfred@colorfullife.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox