From patchwork Wed Nov 6 21:37:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cody P Schafer X-Patchwork-Id: 289031 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 225BA2C0141 for ; Thu, 7 Nov 2013 08:38:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756607Ab3KFVhm (ORCPT ); Wed, 6 Nov 2013 16:37:42 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:52448 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756494Ab3KFVhj (ORCPT ); Wed, 6 Nov 2013 16:37:39 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Nov 2013 14:37:38 -0700 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 6 Nov 2013 14:37:36 -0700 Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 8837F6E803C; Wed, 6 Nov 2013 16:37:33 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22034.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rA6LbZlS61734940; Wed, 6 Nov 2013 21:37:35 GMT Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id rA6LbXM0017744; Wed, 6 Nov 2013 16:37:35 -0500 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id rA6LbX4i017721; Wed, 6 Nov 2013 16:37:33 -0500 Received: from localhost (unknown [9.80.106.172]) by kernel.stglabs.ibm.com (Postfix) with SMTP id 8975F24012A; Wed, 6 Nov 2013 13:37:32 -0800 (PST) From: Cody P Schafer To: Andrew Morton Cc: Andreas Dilger , Jan Kara , LKML , EXT4 , Cody P Schafer Subject: [PATCH] rbtree/test: test rbtree_postorder_for_each_entry_safe() Date: Wed, 6 Nov 2013 13:37:23 -0800 Message-Id: <1383773843-19981-1-git-send-email-cody@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <527AA418.7010009@linux.vnet.ibm.com> References: <527AA418.7010009@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13110621-9332-0000-0000-000002113EBB Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Signed-off-by: Cody P Schafer --- lib/rbtree_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index df6c125..8b3c9dc 100644 --- a/lib/rbtree_test.c +++ b/lib/rbtree_test.c @@ -114,6 +114,16 @@ static int black_path_count(struct rb_node *rb) return count; } +static void check_postorder_foreach(int nr_nodes) +{ + struct test_node *cur, *n; + int count = 0; + rbtree_postorder_for_each_entry_safe(cur, n, &root, rb) + count++; + + WARN_ON_ONCE(count != nr_nodes); +} + static void check_postorder(int nr_nodes) { struct rb_node *rb; @@ -148,6 +158,7 @@ static void check(int nr_nodes) WARN_ON_ONCE(count < (1 << black_path_count(rb_last(&root))) - 1); check_postorder(nr_nodes); + check_postorder_foreach(nr_nodes); } static void check_augmented(int nr_nodes)