Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755274AbcK1UPK (ORCPT ); Mon, 28 Nov 2016 15:15:10 -0500 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:53930 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754799AbcK1T4i (ORCPT ); Mon, 28 Nov 2016 14:56:38 -0500 x-originating-ip: 72.167.245.219 From: Matthew Wilcox To: linux-kernel@vger.kernel.org, Andrew Morton , Konstantin Khlebnikov , Ross Zwisler Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, "Kirill A . Shutemov" Subject: [PATCH v3 10/33] radix tree test suite: Handle exceptional entries Date: Mon, 28 Nov 2016 13:50:14 -0800 Message-Id: <1480369871-5271-11-git-send-email-mawilcox@linuxonhyperv.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1480369871-5271-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1480369871-5271-1-git-send-email-mawilcox@linuxonhyperv.com> X-CMAE-Envelope: MS4wfCYI7bRM92+0QvlKBCl1NYkj2eyh46iZ8o3nxTAbtMHWw7gdqHkjSn8T7OoUzjyys55AicBrGGd1p9EXjMMaDeo5mCerVLZqHHwJ9//ZXEHaOf2hHv0c tC8pnz048mnJp9x80q+nNAGRnU7geNQlS1B3pdz/gb9tPop3faNOCnxXRlgxNMnfU+gvcGWBbkobpdbC6BK8ph0w1x1rd5GSYPXzcstiGN93jh0i3KecIm1e e0YCpzGCtciFBm/dg21UYJkE0BrChK/M7sUzaRA5mc7S7+O5Vq0SmAMkhenOTjDVmPGUkmuZuAgWUu51i+ZDgp0f+koyohC44pESRuq1zjMOGWP4h86y/6rs v1fM/DCtaULWtjbDZwQXV50y70/QmzvF5MIBbr/EzBoFBR2P94JU61wRK5U4Lao8TZdf/ROGcJGY0SXDZ15VGwiJAowMTdMa1CAslXtFHK343TNr/90= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1090 Lines: 35 From: Matthew Wilcox item_kill_tree() assumes that everything in the tree is a pointer to a struct item, which is annoying when testing the behaviour of exceptional entries. Fix it to delete exceptional entries on the assumption they don't need to be freed. Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/test.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/radix-tree/test.c b/tools/testing/radix-tree/test.c index a6e8099..6f8dafc 100644 --- a/tools/testing/radix-tree/test.c +++ b/tools/testing/radix-tree/test.c @@ -200,9 +200,16 @@ void verify_tag_consistency(struct radix_tree_root *root, unsigned int tag) void item_kill_tree(struct radix_tree_root *root) { + struct radix_tree_iter iter; + void **slot; struct item *items[32]; int nfound; + radix_tree_for_each_slot(slot, root, &iter, 0) { + if (radix_tree_exceptional_entry(*slot)) + radix_tree_delete(root, iter.index); + } + while ((nfound = radix_tree_gang_lookup(root, (void **)items, 0, 32))) { int i; -- 2.10.2