public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ocfs2: delete redundant memcmp()
@ 2006-10-12  5:29 Akinobu Mita
  2006-10-12 16:28 ` Mark Fasheh
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2006-10-12  5:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Fasheh, Kurt Hackel

This patch deletes redundant memcmp() while looking up in rb tree.

Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Kurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: Akinbou Mita <akinobu.mita@gmail.com>

 fs/ocfs2/cluster/nodemanager.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: work-fault-inject/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- work-fault-inject.orig/fs/ocfs2/cluster/nodemanager.c
+++ work-fault-inject/fs/ocfs2/cluster/nodemanager.c
@@ -152,14 +152,16 @@ static struct o2nm_node *o2nm_node_ip_tr
 	struct o2nm_node *node, *ret = NULL;
 
 	while (*p) {
+		int cmp;
+
 		parent = *p;
 		node = rb_entry(parent, struct o2nm_node, nd_ip_node);
 
-		if (memcmp(&ip_needle, &node->nd_ipv4_address,
-		           sizeof(ip_needle)) < 0)
+		cmp = memcmp(&ip_needle, &node->nd_ipv4_address,
+				sizeof(ip_needle));
+		if (cmp < 0)
 			p = &(*p)->rb_left;
-		else if (memcmp(&ip_needle, &node->nd_ipv4_address,
-			        sizeof(ip_needle)) > 0)
+		else if (cmp > 0)
 			p = &(*p)->rb_right;
 		else {
 			ret = node;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ocfs2: delete redundant memcmp()
  2006-10-12  5:29 [PATCH] ocfs2: delete redundant memcmp() Akinobu Mita
@ 2006-10-12 16:28 ` Mark Fasheh
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Fasheh @ 2006-10-12 16:28 UTC (permalink / raw)
  To: Akinobu Mita, linux-kernel, Kurt Hackel

On Thu, Oct 12, 2006 at 02:29:33PM +0900, Akinobu Mita wrote:
> This patch deletes redundant memcmp() while looking up in rb tree.
Looks good, thanks.
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-12 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-12  5:29 [PATCH] ocfs2: delete redundant memcmp() Akinobu Mita
2006-10-12 16:28 ` Mark Fasheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox