All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
To: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] hlist_for_each_entry_continue simplification
Date: Tue, 12 Feb 2008 16:50:46 -0800	[thread overview]
Message-ID: <20080213005122.879352336@vyatta.com> (raw)
In-Reply-To: 20080213005042.150212716@vyatta.com

[-- Attachment #1: rcu-continue.patch --]
[-- Type: text/plain, Size: 2921 bytes --]

All the users of hlist_for_each_entry_continue had to intialize pos
before use; change API so pos is a pure temporary variable which matches
the usage of other xxxx_for_each_entry routines.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/include/linux/list.h	2008-02-12 15:09:17.000000000 -0800
+++ b/include/linux/list.h	2008-02-12 15:09:53.000000000 -0800
@@ -944,7 +944,7 @@ static inline void hlist_add_after_rcu(s
  * @member:	the name of the hlist_node within the struct.
  */
 #define hlist_for_each_entry_continue(tpos, pos, member)		 \
-	for (pos = (pos)->next;						 \
+	for (pos = (tpos)->member.next;					 \
 	     pos && ({ prefetch(pos->next); 1;}) &&			 \
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next)
@@ -999,7 +999,7 @@ static inline void hlist_add_after_rcu(s
  * @member:	the name of the hlist_node within the struct.
  */
 #define hlist_for_each_entry_continue_rcu(tpos, pos, member)		\
-	for (pos = (pos)->next;						\
+	for (pos = (tpos)->member.next;					\
 	     rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) &&	\
 		     ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next)
--- a/include/net/sock.h	2008-02-12 15:09:17.000000000 -0800
+++ b/include/net/sock.h	2008-02-12 15:09:53.000000000 -0800
@@ -381,7 +381,7 @@ static __inline__ void sk_add_bind_node(
 	if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
 		hlist_for_each_entry_from(__sk, node, sk_node)
 #define sk_for_each_continue(__sk, node) \
-	if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
+	if (__sk) \
 		hlist_for_each_entry_continue(__sk, node, sk_node)
 #define sk_for_each_safe(__sk, node, tmp, list) \
 	hlist_for_each_entry_safe(__sk, node, tmp, list, sk_node)
--- a/net/ipv4/fib_hash.c	2008-02-12 15:09:17.000000000 -0800
+++ b/net/ipv4/fib_hash.c	2008-02-12 15:09:53.000000000 -0800
@@ -883,7 +883,7 @@ static struct fib_alias *fib_get_next(st
 
 	/* Advance FN. */
 	if (fn) {
-		struct hlist_node *node = &fn->fn_hash;
+		struct hlist_node *node;
 		hlist_for_each_entry_continue(fn, node, fn_hash) {
 			iter->fn = fn;
 
--- a/net/xfrm/xfrm_policy.c	2008-02-12 15:09:17.000000000 -0800
+++ b/net/xfrm/xfrm_policy.c	2008-02-12 15:09:53.000000000 -0800
@@ -577,7 +577,7 @@ int xfrm_policy_insert(int dir, struct x
 
 	read_lock_bh(&xfrm_policy_lock);
 	gc_list = NULL;
-	entry = &policy->bydst;
+
 	hlist_for_each_entry_continue(policy, entry, bydst) {
 		struct dst_entry *dst;
 
--- a/net/ipv4/fib_trie.c	2008-02-12 15:09:46.000000000 -0800
+++ b/net/ipv4/fib_trie.c	2008-02-12 15:12:21.000000000 -0800
@@ -2333,7 +2333,6 @@ static void *fib_trie_seq_next(struct se
 
 	/* walk rest of this hash chain */
 	h = tb->tb_id & (FIB_TABLE_HASHSZ - 1);
-	tb_node = &tb->tb_hlist;
 	hlist_for_each_entry_continue_rcu(tb, tb_node, tb_hlist) {
 		n = trie_get_first(iter, tb);
 		if (n)

-- 
Stephen Hemminger <shemminger@vyatta.com>


  parent reply	other threads:[~2008-02-13  0:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13  0:50 [PATCH 0/4] fib_trie related patches for 2.6.25 Stephen Hemminger
2008-02-13  0:50 ` [PATCH 1/4] rcu_assign_pointer: null check fix Stephen Hemminger
2008-02-13  0:50   ` Stephen Hemminger
2008-02-13  1:27   ` David Miller
2008-02-13  8:07   ` Jarek Poplawski
2008-02-13  0:50 ` [PATCH 2/4] fib_trie: improve output format for /proc/net/fib_trie Stephen Hemminger
2008-02-13  0:50   ` Stephen Hemminger
2008-02-13  2:28   ` Andrew Morton
2008-02-13  3:23     ` Stephen Hemminger
2008-02-13  0:50 ` [PATCH 3/4] fib_trie: print statistics for multiple tables Stephen Hemminger
2008-02-13  2:35   ` Andrew Morton
2008-02-13 22:26     ` Paul E. McKenney
2008-02-13  0:50 ` Stephen Hemminger [this message]
2008-02-13  1:26   ` [PATCH 4/4] hlist_for_each_entry_continue simplification David Miller

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=20080213005122.879352336@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.