All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <mita@miraclelinux.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, Neil Brown <neilb@cse.unsw.edu.au>,
	Prasanna S Panchamukhi <prasanna@in.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 2/8] use hlist_move_head()
Date: Thu, 30 Mar 2006 16:16:07 +0800	[thread overview]
Message-ID: <20060330081729.880726000@localhost.localdomain> (raw)
In-Reply-To: 20060330081605.085383000@localhost.localdomain

[-- Attachment #1: use-hlist-move-head.patch --]
[-- Type: text/plain, Size: 6415 bytes --]

This patch converts the combination of hlist_del(A) and hlist_add_head(A, B)
to hlist_move_head(A, B).

CC: Neil Brown <neilb@cse.unsw.edu.au>
CC: Prasanna S Panchamukhi <prasanna@in.ibm.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

 fs/nfsd/nfscache.c                      |    3 +--
 kernel/kprobes.c                        |   10 +++++-----
 net/core/dev.c                          |    3 +--
 net/ipv4/fib_hash.c                     |    4 +---
 net/ipv4/fib_semantics.c                |    8 ++------
 net/ipv4/ip_fragment.c                  |    4 +---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    3 +--
 net/ipv6/reassembly.c                   |    4 +---
 net/sunrpc/auth.c                       |    9 +++------
 9 files changed, 16 insertions(+), 32 deletions(-)

Index: 2.6-git/fs/nfsd/nfscache.c
===================================================================
--- 2.6-git.orig/fs/nfsd/nfscache.c
+++ 2.6-git/fs/nfsd/nfscache.c
@@ -113,8 +113,7 @@ lru_put_end(struct svc_cacherep *rp)
 static void
 hash_refile(struct svc_cacherep *rp)
 {
-	hlist_del_init(&rp->c_hash);
-	hlist_add_head(&rp->c_hash, hash_list + REQHASH(rp->c_xid));
+	hlist_move_head(&rp->c_hash, hash_list + REQHASH(rp->c_xid));
 }
 
 /*
Index: 2.6-git/kernel/kprobes.c
===================================================================
--- 2.6-git.orig/kernel/kprobes.c
+++ 2.6-git/kernel/kprobes.c
@@ -307,11 +307,11 @@ void __kprobes recycle_rp_inst(struct kr
 	/* remove rp inst off the rprobe_inst_table */
 	hlist_del(&ri->hlist);
 	if (ri->rp) {
-		/* remove rp inst off the used list */
-		hlist_del(&ri->uflist);
-		/* put rp inst back onto the free list */
-		INIT_HLIST_NODE(&ri->uflist);
-		hlist_add_head(&ri->uflist, &ri->rp->free_instances);
+		/*
+		 * remove rp inst off the used list
+		 * and put rp inst back onto the free list
+		 */ 
+		hlist_move_head(&ri->uflist, &ri->rp->free_instances);
 	} else
 		/* Unregistering */
 		kfree(ri);
Index: 2.6-git/net/core/dev.c
===================================================================
--- 2.6-git.orig/net/core/dev.c
+++ 2.6-git/net/core/dev.c
@@ -734,8 +734,7 @@ int dev_change_name(struct net_device *d
 
 	err = class_device_rename(&dev->class_dev, dev->name);
 	if (!err) {
-		hlist_del(&dev->name_hlist);
-		hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
+		hlist_move_head(&dev->name_hlist, dev_name_hash(dev->name));
 		blocking_notifier_call_chain(&netdev_chain,
 				NETDEV_CHANGENAME, dev);
 	}
Index: 2.6-git/net/ipv4/fib_hash.c
===================================================================
--- 2.6-git.orig/net/ipv4/fib_hash.c
+++ 2.6-git/net/ipv4/fib_hash.c
@@ -124,10 +124,8 @@ static inline void fn_rebuild_zone(struc
 		hlist_for_each_entry_safe(f, node, n, &old_ht[i], fn_hash) {
 			struct hlist_head *new_head;
 
-			hlist_del(&f->fn_hash);
-
 			new_head = &fz->fz_hash[fn_hash(f->fn_key, fz)];
-			hlist_add_head(&f->fn_hash, new_head);
+			hlist_move_head(&f->fn_hash, new_head);
 		}
 	}
 }
Index: 2.6-git/net/ipv4/fib_semantics.c
===================================================================
--- 2.6-git.orig/net/ipv4/fib_semantics.c
+++ 2.6-git/net/ipv4/fib_semantics.c
@@ -613,11 +613,9 @@ static void fib_hash_move(struct hlist_h
 			struct hlist_head *dest;
 			unsigned int new_hash;
 
-			hlist_del(&fi->fib_hash);
-
 			new_hash = fib_info_hashfn(fi);
 			dest = &new_info_hash[new_hash];
-			hlist_add_head(&fi->fib_hash, dest);
+			hlist_move_head(&fi->fib_hash, dest);
 		}
 	}
 	fib_info_hash = new_info_hash;
@@ -631,11 +629,9 @@ static void fib_hash_move(struct hlist_h
 			struct hlist_head *ldest;
 			unsigned int new_hash;
 
-			hlist_del(&fi->fib_lhash);
-
 			new_hash = fib_laddr_hashfn(fi->fib_prefsrc);
 			ldest = &new_laddrhash[new_hash];
-			hlist_add_head(&fi->fib_lhash, ldest);
+			hlist_move_head(&fi->fib_lhash, ldest);
 		}
 	}
 	fib_info_laddrhash = new_laddrhash;
Index: 2.6-git/net/ipv4/ip_fragment.c
===================================================================
--- 2.6-git.orig/net/ipv4/ip_fragment.c
+++ 2.6-git/net/ipv4/ip_fragment.c
@@ -149,10 +149,8 @@ static void ipfrag_secret_rebuild(unsign
 						      q->daddr, q->protocol);
 
 			if (hval != i) {
-				hlist_del(&q->list);
-
 				/* Relink to new hash chain. */
-				hlist_add_head(&q->list, &ipq_hash[hval]);
+				hlist_move_head(&q->list, &ipq_hash[hval]);
 			}
 		}
 	}
Index: 2.6-git/net/ipv6/netfilter/nf_conntrack_reasm.c
===================================================================
--- 2.6-git.orig/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ 2.6-git/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -162,9 +162,8 @@ static void nf_ct_frag6_secret_rebuild(u
 						       &q->saddr,
 						       &q->daddr);
 			if (hval != i) {
-				hlist_del(&q->list);
 				/* Relink to new hash chain. */
-				hlist_add_head(&q->list,
+				hlist_move_head(&q->list,
 					       &nf_ct_frag6_hash[hval]);
 			}
 		}
Index: 2.6-git/net/ipv6/reassembly.c
===================================================================
--- 2.6-git.orig/net/ipv6/reassembly.c
+++ 2.6-git/net/ipv6/reassembly.c
@@ -168,10 +168,8 @@ static void ip6_frag_secret_rebuild(unsi
 						       &q->daddr);
 
 			if (hval != i) {
-				hlist_del(&q->list);
-
 				/* Relink to new hash chain. */
-				hlist_add_head(&q->list,
+				hlist_move_head(&q->list,
 					       &ip6_frag_hash[hval]);
 
 			}
Index: 2.6-git/net/sunrpc/auth.c
===================================================================
--- 2.6-git.orig/net/sunrpc/auth.c
+++ 2.6-git/net/sunrpc/auth.c
@@ -149,8 +149,7 @@ rpcauth_free_credcache(struct rpc_auth *
 	for (i = 0; i < RPC_CREDCACHE_NR; i++) {
 		hlist_for_each_safe(pos, next, &cache->hashtable[i]) {
 			cred = hlist_entry(pos, struct rpc_cred, cr_hash);
-			__hlist_del(&cred->cr_hash);
-			hlist_add_head(&cred->cr_hash, &free);
+			hlist_move_head(&cred->cr_hash, &free);
 		}
 	}
 	spin_unlock(&rpc_credcache_lock);
@@ -164,10 +163,8 @@ rpcauth_prune_expired(struct rpc_auth *a
 	       return;
 	if (time_after(jiffies, cred->cr_expire + auth->au_credcache->expire))
 		cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE;
-	if (!(cred->cr_flags & RPCAUTH_CRED_UPTODATE)) {
-		__hlist_del(&cred->cr_hash);
-		hlist_add_head(&cred->cr_hash, free);
-	}
+	if (!(cred->cr_flags & RPCAUTH_CRED_UPTODATE))
+		hlist_move_head(&cred->cr_hash, free);
 }
 
 /*

--

  parent reply	other threads:[~2006-03-30  8:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-30  8:16 [patch 0/8] list.h related cleanups Akinobu Mita
2006-03-30  8:16 ` [patch 1/8] introduce hlist_move_head() Akinobu Mita
2006-03-30  8:16 ` Akinobu Mita [this message]
2006-04-10  8:22   ` [patch 2/8] use hlist_move_head() Andrew Morton
2006-04-10  9:53     ` Neil Brown
2006-03-30  8:16 ` [patch 3/8] use list_add_tail() instead of list_add() Akinobu Mita
2006-03-30  8:26   ` Karsten Keil
2006-03-30  8:30   ` Jan Kara
2006-03-30 10:25     ` David Woodhouse
2006-03-31  3:54   ` Akinobu Mita
2006-03-30  8:16 ` [patch 4/8] arch: use list_move() Akinobu Mita
2006-03-30  8:16 ` [patch 5/8] core: " Akinobu Mita
2006-03-30  8:16 ` [patch 6/8] net/rxrpc: " Akinobu Mita
2006-03-30 10:17   ` David Howells
2006-03-30  8:16 ` [patch 7/8] drivers: " Akinobu Mita
2006-03-30 12:11   ` Matthew Wilcox
2006-03-30  8:16 ` [patch 8/8] fs: " Akinobu Mita
2006-03-30  8:22   ` [-mm patch] reiser4fs: " Akinobu Mita
2006-03-30 10:18   ` [patch 8/8] fs: " David Howells
2006-03-30 19:07   ` Joel Becker
2006-04-03  1:04     ` Ian Kent
2006-03-30 19:15   ` Mark Fasheh

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=20060330081729.880726000@localhost.localdomain \
    --to=mita@miraclelinux.com \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=prasanna@in.ibm.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 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.