From patchwork Sun Jun 17 02:00:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10468351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76726603B4 for ; Sun, 17 Jun 2018 02:04:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6726628CF7 for ; Sun, 17 Jun 2018 02:04:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BCFA28D2E; Sun, 17 Jun 2018 02:04:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D874228CF7 for ; Sun, 17 Jun 2018 02:04:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B16A6B029B; Sat, 16 Jun 2018 22:01:44 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 637926B029C; Sat, 16 Jun 2018 22:01:44 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43D266B029D; Sat, 16 Jun 2018 22:01:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id EB2C76B029C for ; Sat, 16 Jun 2018 22:01:43 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id x32-v6so7696710pld.16 for ; Sat, 16 Jun 2018 19:01:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=tlIfOaZD65OibIYNa71Eb6Qj73wPp5+FWyuOeHJmT1I=; b=ASppzu1mW+nNigHz3PXkyJatF8lmESDc4YAHt41tmMfFaIa2tVgsMmC64Vm/VaBS4a RjsGcGLzo41ugpFQh7hCn1rwlB5rldYHRJmtp7/HORDFkc82syopEcjBlJQm8TWwiadn 73+2JKF8bYz2q0nsQxe9ZhxOP29c4AHQAzWZ1n4jxj49ru88jPOYoDi5BvPSg21Wdhys 7vMbt4w6ldD1SIFswmz934DcUQ6GeZvwV1ZjvgEfLU9KXxMKO58sGumwyYo5+iaXs+F8 jDVieGBCTLiRcNF9jaqFbQMcGLQmlU4xYo18bffBbCdZmRKf56lRSZ5bihkAUCeDvzsy yDQg== X-Gm-Message-State: APt69E2yhdd+wwpBz2coZRPL5miE1qkZ2fK5kOISGlcbptCddHbpHiLJ 6qLYzad/STshcV9HWLkq/BDX4MnL+1UA224EMhoNXyrqC5ew1P9Yt8HJxzQ5dExBiV0L9RLVVV4 upJRF7Q8nxn2PGLBLn/6VgmoTMQIKJP9fszLos9Vruncz87GgqMKo6RAB6JRYUaHkDQ== X-Received: by 2002:aa7:820e:: with SMTP id k14-v6mr8053722pfi.97.1529200903628; Sat, 16 Jun 2018 19:01:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJyB6EcPm//IViB7OlPBmlRLZ9BCAj3ajIFX49Dug/TVxg4OXCwrLXkIGId/GDgogY9xvMI X-Received: by 2002:aa7:820e:: with SMTP id k14-v6mr8053659pfi.97.1529200902628; Sat, 16 Jun 2018 19:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529200902; cv=none; d=google.com; s=arc-20160816; b=eGP4w5G3kW5is8Nmq1fpIF5zqUr1uD/1t2zqsfI8bddvvRf1fkSe89ZYYE/vWLSWQx ThdKlAQ57fvFCpKlimxYMdkKkN/LbB0YHNy0uhIYZq7ogVRcJ1Hp8sgzkAKkoJz5VUWk A/RcQBZRko8wreeAu7qbCvkKEbsIE0ONr/fCLT4SpAdFXkpyBmblygQmU20QJg0iEsA/ SLgBHDL0l2Fa8xrHQGZ8YKV2kZXDsTgPKeEOyIUc+QkiGytKd47BEJtbcLQx1GO+NMyp wriKUtBLEy0dIIQUDo+sRAfe9TAT0lyvl7M0o6NlRb0ZiIlmXZi1Vk8OXwWRDtEFTcPp BRAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=tlIfOaZD65OibIYNa71Eb6Qj73wPp5+FWyuOeHJmT1I=; b=UqpFM7hkLC1BNXmrwfu2Ejbmva6mHBjz18QH5rfIDjikEyXsCfuoWXgm49vGQyIXH/ woyngLQzfTWSVGyeWd9zNrKfDJd5Yaz7TEVti9UgGBDKX0Q3irxI7yV1RJiyPmo4ztju bX/KJK+M71fM75DBy0TnJtHWD7mCaLk+miY1wSXH1L6ZmBlJMg3t2ktuZJX2hKe+NY6W o6eqbZzbM85sNjP/wXG2eYPYR56/oKRRBW0VCThRIPf2b8hinCiktAZ7ebvAjWWqJSdx n+OH30ioxaOvlkeEodLZBCm/IgcNlHl7PUM7iJ0aGusec8OIrjLcW1GiHBo84lsz1LF0 rObg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b="V/VP50i1"; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id r12-v6si11386508pfj.331.2018.06.16.19.01.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Jun 2018 19:01:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b="V/VP50i1"; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tlIfOaZD65OibIYNa71Eb6Qj73wPp5+FWyuOeHJmT1I=; b=V/VP50i1eGq1JBQnXZQYQRIOA 5LuYCBaKRl82oGGXEJmt+4m8/2BmzbrRhIUa2JSfJEleDINrEiAbIHVA6fM/JtH3iG6Lh5AJtSWbW 11k0991Zkcqc8hwTeen1vgdanb9r1NhVoL1JSpFGDBqORQWeRjMIoaAN9fcTyx4i7kzp8oA0cIYZs 8F7vBGmx56kmQjmyjuB4B/B0oSNVzKAE/x11+j18U9GJail1FJJy0ci+y1qkPTJycDDUDTM4ksRgW s5pT0JujDsHjOG6BM4OcnLEQcdiKsiC/vNHIcnnt0g4pId8rJsNZ11XXrQWXHDwJjkl2zsWF4JxMw vsK9H5MmA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUN0f-0001j4-8d; Sun, 17 Jun 2018 02:01:41 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Jan Kara , Jeff Layton , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues , Nicholas Piggin , Ryusuke Konishi , linux-nilfs@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH v14 74/74] radix tree: Remove radix_tree_clear_tags Date: Sat, 16 Jun 2018 19:00:52 -0700 Message-Id: <20180617020052.4759-75-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180617020052.4759-1-willy@infradead.org> References: <20180617020052.4759-1-willy@infradead.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The page cache was the only user of this interface and it has now been converted to the XArray. Transform the test into a test of xas_init_tags(). Signed-off-by: Matthew Wilcox --- include/linux/radix-tree.h | 2 -- lib/radix-tree.c | 13 ----------- lib/test_xarray.c | 33 ++++++++++++++++++++++++++++ tools/testing/radix-tree/tag_check.c | 29 ------------------------ 4 files changed, 33 insertions(+), 44 deletions(-) diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index f8ef267e4975..27c15990951d 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -252,8 +252,6 @@ void radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter *iter, void __rcu **slot); void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); void *radix_tree_delete(struct radix_tree_root *, unsigned long); -void radix_tree_clear_tags(struct radix_tree_root *, struct radix_tree_node *, - void __rcu **slot); unsigned int radix_tree_gang_lookup(const struct radix_tree_root *, void **results, unsigned long first_index, unsigned int max_items); diff --git a/lib/radix-tree.c b/lib/radix-tree.c index ad03dc0c562f..101f1c28e1b6 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -1711,19 +1711,6 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) } EXPORT_SYMBOL(radix_tree_delete); -void radix_tree_clear_tags(struct radix_tree_root *root, - struct radix_tree_node *node, - void __rcu **slot) -{ - if (node) { - unsigned int tag, offset = get_slot_offset(node, slot); - for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) - node_tag_clear(root, node, tag, offset); - } else { - root_tag_clear_all(root); - } -} - /** * radix_tree_tagged - test whether any items in the tree are tagged * @root: radix tree root diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 0ac0c8108ef4..98c0efdd27a0 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c @@ -170,12 +170,45 @@ static void check_xa_tag_1(struct xarray *xa, unsigned long index) XA_BUG_ON(xa, !xa_empty(xa)); } +static void check_xa_tag_2(struct xarray *xa) +{ + XA_STATE(xas, xa, 0); + unsigned long index; + unsigned int count = 0; + void *entry; + + xa_store_value(xa, 0, GFP_KERNEL); + xa_set_tag(xa, 0, XA_TAG_0); + xas_load(&xas); + xas_init_tags(&xas); + XA_BUG_ON(xa, !xa_get_tag(xa, 0, XA_TAG_0) == 0); + + for (index = 3500; index < 4500; index++) { + xa_store_value(xa, index, GFP_KERNEL); + xa_set_tag(xa, index, XA_TAG_0); + } + + xas_reset(&xas); + xas_for_each_tagged(&xas, entry, ULONG_MAX, XA_TAG_0) + count++; + XA_BUG_ON(xa, count != 1000); + + xas_for_each(&xas, entry, ULONG_MAX) { + xas_init_tags(&xas); + XA_BUG_ON(xa, !xa_get_tag(xa, xas.xa_index, XA_TAG_0)); + XA_BUG_ON(xa, !xas_get_tag(&xas, XA_TAG_0)); + } + + xa_destroy(xa); +} + static void check_xa_tag(struct xarray *xa) { check_xa_tag_1(xa, 0); check_xa_tag_1(xa, 4); check_xa_tag_1(xa, 64); check_xa_tag_1(xa, 4096); + check_xa_tag_2(xa); } static void check_xa_shrink(struct xarray *xa) diff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c index 543181e4847b..56a42f1c5ab0 100644 --- a/tools/testing/radix-tree/tag_check.c +++ b/tools/testing/radix-tree/tag_check.c @@ -331,34 +331,6 @@ static void single_check(void) item_kill_tree(&tree); } -void radix_tree_clear_tags_test(void) -{ - unsigned long index; - struct radix_tree_node *node; - struct radix_tree_iter iter; - void **slot; - - RADIX_TREE(tree, GFP_KERNEL); - - item_insert(&tree, 0); - item_tag_set(&tree, 0, 0); - __radix_tree_lookup(&tree, 0, &node, &slot); - radix_tree_clear_tags(&tree, node, slot); - assert(item_tag_get(&tree, 0, 0) == 0); - - for (index = 0; index < 1000; index++) { - item_insert(&tree, index); - item_tag_set(&tree, index, 0); - } - - radix_tree_for_each_slot(slot, &tree, &iter, 0) { - radix_tree_clear_tags(&tree, iter.node, slot); - assert(item_tag_get(&tree, iter.index, 0) == 0); - } - - item_kill_tree(&tree); -} - void tag_check(void) { single_check(); @@ -376,5 +348,4 @@ void tag_check(void) thrash_tags(); rcu_barrier(); printv(2, "after thrash_tags: %d allocated\n", nr_allocated); - radix_tree_clear_tags_test(); }