Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965278AbWJLF3M (ORCPT ); Thu, 12 Oct 2006 01:29:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965283AbWJLF3M (ORCPT ); Thu, 12 Oct 2006 01:29:12 -0400 Received: from py-out-1112.google.com ([64.233.166.179]:51160 "EHLO py-out-1112.google.com") by vger.kernel.org with ESMTP id S965278AbWJLF3L (ORCPT ); Thu, 12 Oct 2006 01:29:11 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:mail-followup-to:mime-version:content-type:content-disposition:user-agent; b=a8zRbbuluhOPCsBglnIONfmcA+1WlPQdfx/Z8O181kRnzmhjKGPpThy0JjiCECmJuJ9fGPfztiQOvez2crYzuPaDVRb0FhZW7tAUh8QQy0EM9j6G1nbUH2JDwe35rdPu9nrv/9gxtWEmszCg+eKAFuXjTHffDtzAHFfAJF6CDBs= Date: Thu, 12 Oct 2006 14:29:33 +0900 From: Akinobu Mita To: linux-kernel@vger.kernel.org Cc: Mark Fasheh , Kurt Hackel Subject: [PATCH] ocfs2: delete redundant memcmp() Message-ID: <20061012052933.GB29465@localhost> Mail-Followup-To: Akinobu Mita , linux-kernel@vger.kernel.org, Mark Fasheh , Kurt Hackel MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1360 Lines: 39 This patch deletes redundant memcmp() while looking up in rb tree. Cc: Mark Fasheh Cc: Kurt Hackel Signed-off-by: Akinbou Mita 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; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/