From patchwork Mon Jun 11 14:06:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10458043 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 7055960532 for ; Mon, 11 Jun 2018 14:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F0492846D for ; Mon, 11 Jun 2018 14:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 575D42867C; Mon, 11 Jun 2018 14:13:11 +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 5DBE4288B5 for ; Mon, 11 Jun 2018 14:12:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A4BE6B02A6; Mon, 11 Jun 2018 10:07:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 329C16B02A8; Mon, 11 Jun 2018 10:07:18 -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 180C86B02AA; Mon, 11 Jun 2018 10:07:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by kanga.kvack.org (Postfix) with ESMTP id C28A76B02A6 for ; Mon, 11 Jun 2018 10:07:17 -0400 (EDT) Received: by mail-pg0-f70.google.com with SMTP id z11-v6so6629911pgu.1 for ; Mon, 11 Jun 2018 07:07:17 -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=ynh2wcxEjkHUCCf5sVGFt2iVMlo/bLiazXSXh5mbgyo=; b=o9K0iy2tWKwesszxhpA9XxLh3otsXew7tSMxRSv60Uu0KIcWE/TKRcHwcr7N7f+Hs5 y9w3AYLHwE1JJjEGqgr1rVN8vMEcfUrFojaLq3kzri+vFpJ2XOvdXOvOTyTV8Tuvs7wP 4m1n2AhhTChyL20BHBXGlZrOue8JW3jz4J2rDOVOelRlSKKYmpKgD1RmFGL2hsavThkt Kj+llsEAlUESyEyMXIQV9aeXfYN0fyi9VQ0Y948+qpkQrjHOOcfI8pApfzl3AoBLItKd LGDEGsEDGFRTnx6/bphRN1bWMOqqR78eNHWq+nR3/IQ+LWOseQtfjq5xDcEBmWbVMSyM T+uw== X-Gm-Message-State: APt69E3iLrMJtxuJ1w+/SvDsI5kJOSlOAAdE3rrMEIpEflt26gbYaSPM 5o/q+Y2wcFqSu31JmxJ3ozlpOTVVh5BeSlfyF6d4PM/OU9XGlPQE6k5nScqYrDMXxkpZtyYrjnM W70dfo7GvxHtbL6x9japPXKBLDMl+eay8xoK91DKpCxqKjNprHwufehxtYWzl/AVMnw== X-Received: by 2002:a62:e310:: with SMTP id g16-v6mr17850249pfh.25.1528726037437; Mon, 11 Jun 2018 07:07:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLYu2iO1OG/klVyQ848UsNAdcT3absd9OCg+hJDtdl2V4Rn8NFyaxQzvC1Of5JqQzwE9ZDW X-Received: by 2002:a62:e310:: with SMTP id g16-v6mr17850185pfh.25.1528726036420; Mon, 11 Jun 2018 07:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726036; cv=none; d=google.com; s=arc-20160816; b=EDYyUnxSLX0m3c3SAiwN3v5ms1nF6sJK7snzd4pYCHUwpLpJX3r8OFTyFnKQfsSRLs bl5HZwWUAxp5Qkdw/t2d7pPBTyI1fLTXt1LrrqW+sqI0dE8qYSjzmfbltdYMtu2wN11r oM4YArbHXfeBw8Qv8rkzut9BM+EamrYiEWkFd4gDnP9GNGj3Rb3ODYRw6mxSX9mUsXxZ Q81kdLqWuK3DHshAFomRQvUm0vCKMLybQCqhx92N02WnJe23NtGwxMgEGfDPuKJUaEZF r/76KYOPzsypkft3MaM9m2xvHxDt+BI7BB3fpPOSQtMhovjaawAJTHq2tcX7xPJr6QLg 2lnw== 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=ynh2wcxEjkHUCCf5sVGFt2iVMlo/bLiazXSXh5mbgyo=; b=lzunqiK8imRxG0X5jZwY/ZXMGWUxOALqrUVlPDspRB2SWXmz2nVRdiPJ7w6QkH4agw WuRTKnFnhoZnU7/qRGn6qIWXuGtWhAgXCkTGMw+WDsQauGiDtL45OrKMq/wYtz0gneBn rq651EBYFfuj4oCI9NgnFdKVmsms1fG/4ORPZJuqupSvfZPkSfodnzrVK2jPKQgQiO1f MSjNg7n17PEJOHcZyihaHrTgLLmWd0YWID7qT9tKoQJvEDxxrg1YfcgM1CoBRTauwj/P Tv/mNGhxiVKs8b94DY3c1DIUSNb/6IZCg0lNNTV6AT9ST5y4CnyfS+0GbxSMPU1HP7Dc zPGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=W7MyQqs2; 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 k9-v6si19738266pfc.129.2018.06.11.07.07.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 07:07:16 -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=W7MyQqs2; 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=ynh2wcxEjkHUCCf5sVGFt2iVMlo/bLiazXSXh5mbgyo=; b=W7MyQqs2mqDmueKISb2fnPkpk y/GOIFtUtIazDSRPCIdIrI7q0D3IDURUIyI8mPo8p6Mxtt8T4HR1TvdlXi4f7sohCdoiM7FljzA6d 0vT6lvRK51yCe5Oyjd6aUtw8iAsF2p/qP0CvULrr6E+IIogqKNAhgiMiFi4X2lRfT++DSHhHg9NxK tn8CgFwxTADAlRbOIjRti4P0vRvPWCx7SJnzWP3SBtiKBpJyxGQ8rsQwkFXZKDBksCeW9grr3yp+N KNbow2xqcdOcqTrwe8x9VE2ynyS0DPNCmctlw1uPaYI7nMiiSWc1dnVt3Xo8IP+YCQqcnjcQHuFRg fRknCI0tQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSNTW-00054e-Nx; Mon, 11 Jun 2018 14:07:15 +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 v13 69/72] radix tree: Remove radix_tree_update_node_t Date: Mon, 11 Jun 2018 07:06:36 -0700 Message-Id: <20180611140639.17215-70-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180611140639.17215-1-willy@infradead.org> References: <20180611140639.17215-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 From: Matthew Wilcox The only user of this functionality was the workingset code, and it's now been converted to the XArray. Remove __radix_tree_delete_node() entirely as it was also only used by the workingset code. Signed-off-by: Matthew Wilcox --- include/linux/radix-tree.h | 7 +---- lib/idr.c | 2 +- lib/radix-tree.c | 42 +++++---------------------- tools/testing/radix-tree/multiorder.c | 2 +- 4 files changed, 11 insertions(+), 42 deletions(-) diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 081e68b4376b..fc13c4b1afdb 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -242,17 +242,12 @@ void *__radix_tree_lookup(const struct radix_tree_root *, unsigned long index, void *radix_tree_lookup(const struct radix_tree_root *, unsigned long); void __rcu **radix_tree_lookup_slot(const struct radix_tree_root *, unsigned long index); -typedef void (*radix_tree_update_node_t)(struct radix_tree_node *); void __radix_tree_replace(struct radix_tree_root *, struct radix_tree_node *, - void __rcu **slot, void *entry, - radix_tree_update_node_t update_node); + void __rcu **slot, void *entry); void radix_tree_iter_replace(struct radix_tree_root *, const struct radix_tree_iter *, void __rcu **slot, void *entry); void radix_tree_replace_slot(struct radix_tree_root *, void __rcu **slot, void *entry); -void __radix_tree_delete_node(struct radix_tree_root *, - struct radix_tree_node *, - radix_tree_update_node_t update_node); 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 *); diff --git a/lib/idr.c b/lib/idr.c index 0d7410d1fb7c..58b88f5eb672 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -303,7 +303,7 @@ void *idr_replace(struct idr *idr, void *ptr, unsigned long id) if (!slot || radix_tree_tag_get(&idr->idr_rt, id, IDR_FREE)) return ERR_PTR(-ENOENT); - __radix_tree_replace(&idr->idr_rt, node, slot, ptr, NULL); + __radix_tree_replace(&idr->idr_rt, node, slot, ptr); return entry; } diff --git a/lib/radix-tree.c b/lib/radix-tree.c index d0f44ea96945..001062d41f9f 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -610,8 +610,7 @@ static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp, * radix_tree_shrink - shrink radix tree to minimum height * @root radix tree root */ -static inline bool radix_tree_shrink(struct radix_tree_root *root, - radix_tree_update_node_t update_node) +static inline bool radix_tree_shrink(struct radix_tree_root *root) { bool shrunk = false; @@ -671,8 +670,6 @@ static inline bool radix_tree_shrink(struct radix_tree_root *root, node->count = 0; if (!radix_tree_is_internal_node(child)) { node->slots[0] = (void __rcu *)RADIX_TREE_RETRY; - if (update_node) - update_node(node); } WARN_ON_ONCE(!list_empty(&node->private_list)); @@ -684,8 +681,7 @@ static inline bool radix_tree_shrink(struct radix_tree_root *root, } static bool delete_node(struct radix_tree_root *root, - struct radix_tree_node *node, - radix_tree_update_node_t update_node) + struct radix_tree_node *node) { bool deleted = false; @@ -695,7 +691,7 @@ static bool delete_node(struct radix_tree_root *root, if (node->count) { if (node_to_entry(node) == rcu_dereference_raw(root->xa_head)) - deleted |= radix_tree_shrink(root, update_node); + deleted |= radix_tree_shrink(root); return deleted; } @@ -1100,15 +1096,13 @@ static int calculate_count(struct radix_tree_root *root, * @node: pointer to tree node * @slot: pointer to slot in @node * @item: new item to store in the slot. - * @update_node: callback for changing leaf nodes * * For use with __radix_tree_lookup(). Caller must hold tree write locked * across slot lookup and replacement. */ void __radix_tree_replace(struct radix_tree_root *root, struct radix_tree_node *node, - void __rcu **slot, void *item, - radix_tree_update_node_t update_node) + void __rcu **slot, void *item) { void *old = rcu_dereference_raw(*slot); int values = !!xa_is_value(item) - !!xa_is_value(old); @@ -1126,10 +1120,7 @@ void __radix_tree_replace(struct radix_tree_root *root, if (!node) return; - if (update_node) - update_node(node); - - delete_node(root, node, update_node); + delete_node(root, node); } /** @@ -1151,7 +1142,7 @@ void __radix_tree_replace(struct radix_tree_root *root, void radix_tree_replace_slot(struct radix_tree_root *root, void __rcu **slot, void *item) { - __radix_tree_replace(root, NULL, slot, item, NULL); + __radix_tree_replace(root, NULL, slot, item); } EXPORT_SYMBOL(radix_tree_replace_slot); @@ -1168,7 +1159,7 @@ void radix_tree_iter_replace(struct radix_tree_root *root, const struct radix_tree_iter *iter, void __rcu **slot, void *item) { - __radix_tree_replace(root, iter->node, slot, item, NULL); + __radix_tree_replace(root, iter->node, slot, item); } #ifdef CONFIG_RADIX_TREE_MULTIORDER @@ -1848,23 +1839,6 @@ radix_tree_gang_lookup_tag_slot(const struct radix_tree_root *root, } EXPORT_SYMBOL(radix_tree_gang_lookup_tag_slot); -/** - * __radix_tree_delete_node - try to free node after clearing a slot - * @root: radix tree root - * @node: node containing @index - * @update_node: callback for changing leaf nodes - * - * After clearing the slot at @index in @node from radix tree - * rooted at @root, call this function to attempt freeing the - * node and shrinking the tree. - */ -void __radix_tree_delete_node(struct radix_tree_root *root, - struct radix_tree_node *node, - radix_tree_update_node_t update_node) -{ - delete_node(root, node, update_node); -} - static bool __radix_tree_delete(struct radix_tree_root *root, struct radix_tree_node *node, void __rcu **slot) { @@ -1880,7 +1854,7 @@ static bool __radix_tree_delete(struct radix_tree_root *root, node_tag_clear(root, node, tag, offset); replace_slot(slot, NULL, node, -1, values); - return node && delete_node(root, node, NULL); + return node && delete_node(root, node); } /** diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c index c659056340df..fc7d0c4e812a 100644 --- a/tools/testing/radix-tree/multiorder.c +++ b/tools/testing/radix-tree/multiorder.c @@ -618,7 +618,7 @@ static void multiorder_account(void) __radix_tree_insert(&tree, 1 << 5, 5, xa_mk_value(5)); __radix_tree_lookup(&tree, 1 << 5, &node, &slot); assert(node->count == node->nr_values * 2); - __radix_tree_replace(&tree, node, slot, NULL, NULL); + __radix_tree_replace(&tree, node, slot, NULL); assert(node->nr_values == 0); item_kill_tree(&tree);