Received: by 10.223.164.202 with SMTP id h10csp663445wrb; Wed, 22 Nov 2017 13:17:17 -0800 (PST) X-Google-Smtp-Source: AGs4zMZvVkmBXNAS+gz5egO1zpMorfq9VwTGOLA9KZRdgku7cKNj9uZfMPVWuH7uO30Rk2QLFyvS X-Received: by 10.84.134.34 with SMTP id 31mr22973698plg.154.1511385437006; Wed, 22 Nov 2017 13:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511385436; cv=none; d=google.com; s=arc-20160816; b=oQcK/8CRWBtwppK2ciIIOFPbo0Vmwj7mBZXenE9T7xTanXXHgdqvnZiAXlEe7OA0L0 DSyuBtDTCXWZai7QnGTV9FU8Gef4TwgUeqrfP2KfFufqt5NdTe1bUTJEE4JHRT1Ncs2C m9XssI23Hv65p3RSWbk2x/isiOy3tKciC657/I8JaPsb18X4P5wYk7qVgYfU71Iad6YD HC7wby8W6223C4+4b8i2N+my73UIVMhScagKcF0khVc+EjE2uAg8BxL0I9rVzVwVE9RH XpcPat53g5Ysjx54pZtbiP1iI3JYIlnO7cuJW6n4/G3byJ25nbZDdskbssHT0xHtWKGv DLmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BjdPG3ccLCx3iqlAoXMncSbXtSmcMqYIGceIWc66WxU=; b=MGRvhjrM/FOeq8cUiq/e/269UM3AiD2HK/on/TvA8hhIKh3+wy9oLTPeCrg3aUeNlH VdYxtZGj7S2bf5f8v+Dvuu6atWQPqg4KV2vDLahHVkRITWV8U4sEeY0k9gaeURd69+WJ YY5PwjtRj4GDgBBvN/Opcr+Giln0NbKjKUhcOx0wzeFCoSzfCNUSJTqWmY8zNf9NZCWr euNdRi/Fabx7vTK4vHtRBBI5gINJeU5LHaMuoZTJw2Q//zAZWEN64q90dsVfB87193CX aXURsU6vTgxzYPEohPEjagokbGPkfHokiukN0u+7nazPqXIdKPJnYfJn0UVK5DSzWIhS MYCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VKi0zXHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w61si8288185plb.736.2017.11.22.13.16.59; Wed, 22 Nov 2017 13:17:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VKi0zXHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752357AbdKVVOf (ORCPT + 77 others); Wed, 22 Nov 2017 16:14:35 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:37076 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbdKVVIT (ORCPT ); Wed, 22 Nov 2017 16:08:19 -0500 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=BjdPG3ccLCx3iqlAoXMncSbXtSmcMqYIGceIWc66WxU=; b=VKi0zXHg+x2p38idH3XiJAJ48 lRHea76YeN6903Fu+W1tFzm8YQsUIgX2+Q/Sd+w/fS8x29bzYmYMNKTwsZZGA5sSYA9gYwUbqiNal ONlytq594r3kz/NV8M7fD43PWrV/gTouKQ6pkp8FQgqubesPXouVBUoQ6LYGOdSeUFpEh6wFD9KuU IGeRMNJF/vMLTrJoHL9m22OLczbzPMVtlELyDoJB6Ol9ff974HAh6bhOr7IE1cLsuzwQQ6I6oEEPV fCKwSm9a1nkqjIy27ZhMakwzJgnFLTKTXAZspXGsrkTDKg6LIyTKSGtNPvm3uItyojrZ0ljHFmfs7 w+4UruX8w==; Received: from willy by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1eHcFm-0007vo-Hu; Wed, 22 Nov 2017 21:08:18 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox Subject: [PATCH 35/62] page cache: Convert page_cache_tree_delete to xarray Date: Wed, 22 Nov 2017 13:07:12 -0800 Message-Id: <20171122210739.29916-36-willy@infradead.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171122210739.29916-1-willy@infradead.org> References: <20171122210739.29916-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox The code is slightly shorter and simpler. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 1d520748789b..f60f22867a1a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -115,27 +115,25 @@ static void page_cache_tree_delete(struct address_space *mapping, struct page *page, void *shadow) { - int i, nr; + XA_STATE(xas, page->index); + unsigned int i, nr; - /* hugetlb pages are represented by one entry in the radix tree */ + xas_set_update(&xas, workingset_lookup_update(mapping)); + + /* hugetlb pages are represented by a single entry in the xarray */ nr = PageHuge(page) ? 1 : hpage_nr_pages(page); VM_BUG_ON_PAGE(!PageLocked(page), page); VM_BUG_ON_PAGE(PageTail(page), page); VM_BUG_ON_PAGE(nr != 1 && shadow, page); - for (i = 0; i < nr; i++) { - struct radix_tree_node *node; - void **slot; - - __radix_tree_lookup(&mapping->pages, page->index + i, - &node, &slot); - - VM_BUG_ON_PAGE(!node && nr != 1, page); - - radix_tree_clear_tags(&mapping->pages, node, slot); - __radix_tree_replace(&mapping->pages, node, slot, shadow, - workingset_lookup_update(mapping)); + i = nr; +repeat: + xas_store(&mapping->pages, &xas, shadow); + xas_init_tags(&mapping->pages, &xas); + if (--i) { + xas_next_any(&mapping->pages, &xas); + goto repeat; } page->mapping = NULL; -- 2.15.0 From 1584731426362085824@xxx Wed Nov 22 02:27:39 +0000 2017 X-GM-THRID: 1584731426362085824 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread