From patchwork Mon Jun 11 14:06:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10458033 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 5254E601A0 for ; Mon, 11 Jun 2018 14:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30BEF2852E for ; Mon, 11 Jun 2018 14:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DB48287E8; Mon, 11 Jun 2018 14:12:49 +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 510B52852E for ; Mon, 11 Jun 2018 14:11:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E29856B02A4; Mon, 11 Jun 2018 10:07:15 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D87DA6B02A5; Mon, 11 Jun 2018 10:07:15 -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 C2A066B02A6; Mon, 11 Jun 2018 10:07:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 79EDB6B02A4 for ; Mon, 11 Jun 2018 10:07:15 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id i1-v6so12149167pld.11 for ; Mon, 11 Jun 2018 07:07:15 -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=fCreVfG9TwLx1z/ixiLbiSZKlPIkYtrNKgCJWPPAZNM=; b=eL6aaRtyuoIXFrDf7eEeiPnkGXfBUO8BIPCCcYXsYTuJN2Ng4SxDsCZQqQnxNht3Hk yT+jWshHEAiSduDaioRYGofGt9Pu3Moeee8JtrvGYRL/geg7TweDhP9HfzP7xWUCpOJt 7/+Z4g4DOyYPLc8iFoXLOrOPjrQLGUTv7+dPMyyFrl47kdCEF6p9+g0MxJFeOTM06E5Y woaZkK1dcAdrXaJMYDKZZOOkHSJ8SN4OSpjLVq7S2LonAMwqu7nCJ28qL/dUGw2xHSUE UiduD3z7YKKaFW/OHR32SCjQWVNJtVsrBTgcJomjZAlEl3TLSAt+Vy42uzPekHagDRUW gFPA== X-Gm-Message-State: APt69E2VZrAoPVvPcZaZljNiliPW4RGO2guPGZN1vgcOemnSpMODPFH6 fD3OaPOktc40ctgrEAZ4NuC17iqX+fqOZow2yYC1qrwjX9UvYvWmO7mDakCK3B1pAQXCRsrsU66 gU9qloQXO4otyrrW/EbyxkwXNi0QgO2SerDolxDqWSn2Hq/gnJFKQPBy3ihq8qh4FXQ== X-Received: by 2002:a63:b257:: with SMTP id t23-v6mr15356925pgo.431.1528726035149; Mon, 11 Jun 2018 07:07:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKDC/PeiNmF+uzrF7EbK/2SjKQDPro9KiZGIPIrJrTRSyJLyAiras5C2aqBBBEPSjA/tFOI X-Received: by 2002:a63:b257:: with SMTP id t23-v6mr15356865pgo.431.1528726034050; Mon, 11 Jun 2018 07:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726034; cv=none; d=google.com; s=arc-20160816; b=IWVkcJbWHjBUCYW+LnW9PlAYSVvFzzpwByDOpbgvzAIuFWkTg7Lb5VIma+SnV04ICP mrW3IgrkBrDO1pkpss09A1hZf1Rf9xOUL7CpN9bhI6id6JOgSA3tvyG77fdUKHCnsBHl tGobH0u6HNN+pBRg/THM2ROpB+cr2RWkHgn/0JUXzy5aucdep5tiuSOlBJyHPvdsausp wxHUQ+PtZ0lSmE/c67+3jspkcXnIsxduCftYXgxcrM4qtLBBJYIP4XlxR7oBuqacOAH/ NhKg0EIo+XERTmf3OvyPlt1ywgL46djhLsVWjdRGVu664Eix8ZWfQtyy+jJgfv9JzWR5 KEBw== 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=fCreVfG9TwLx1z/ixiLbiSZKlPIkYtrNKgCJWPPAZNM=; b=mzRQ7N5YIy3LDrZKYvALnyV9aooB9RpZPaK16lFIUqtB2xPNt6pAP042G6JnMQRhnh A+l9jH+izQ5kSCSuo6o3U5GYDQF/HosD4b4M87z5IHXDN0SHc3sgdV08JhCwflCS31qc AmFSP1zxKao/lg0SDDwUZ6vvPhtjSRrhAF5bV+M29z0zNNyXPBTwd/R7o52rTXZs+8IJ zaJzmsMR9xIJKlH61oQaxdWhFB+p6W7IbVoUQQZR9tkynO2ZulREFrQMrbIu7CZkwhdW lj5RMtHROwhgZckQ9sPO3IdqxaIDFjNxwti+4jINchGjrpPmRtoSmq2UCbwC7bb5ifM8 uzPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=PwGWEwmu; 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 u196-v6si14378342pgc.137.2018.06.11.07.07.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 07:07:14 -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=PwGWEwmu; 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=fCreVfG9TwLx1z/ixiLbiSZKlPIkYtrNKgCJWPPAZNM=; b=PwGWEwmufo3hJ/POe70x8apod V0Av8onp7BgdFi35c12tDaJ40E+/Dz+C9lzrUub9r4zTCovefNJHAsXSoxVkdapVwSUl9RZdr39lD O7kk98QK6Icq0KSIiDBOl8cj3adXQCFtKVFn3bX0IlDzUMoCFhT3Cn1cghRWZms1nybyRcWb1Rq/7 eOmaYRN1/XG5RFkRQqjUlkMUNnq/VOaIpdXMAOkicxP+PonPWPlvj2g49PfCvEX0wyiVLbE3hu5m/ QdZu9WHzSjgTji2ZnF1y3gIq4DAO2wRZYCa6mr2GpqBbIIYs4ODpBBi4ocJ7j+nvFkpXAhdcudaSh eFsCAidfg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSNTU-00053B-O1; Mon, 11 Jun 2018 14:07:12 +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 65/72] dax: Convert __dax_invalidate_entry to XArray Date: Mon, 11 Jun 2018 07:06:32 -0700 Message-Id: <20180611140639.17215-66-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 Avoids walking the radix tree multiple times looking for tags. Signed-off-by: Matthew Wilcox --- fs/dax.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index b8ed7bf32ba1..0566a150c458 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -676,27 +676,28 @@ EXPORT_SYMBOL_GPL(dax_layout_busy_page); static int __dax_invalidate_entry(struct address_space *mapping, pgoff_t index, bool trunc) { + XA_STATE(xas, &mapping->i_pages, index); int ret = 0; void *entry; - struct radix_tree_root *pages = &mapping->i_pages; - xa_lock_irq(pages); - entry = get_unlocked_mapping_entry(mapping, index, NULL); + xas_lock_irq(&xas); + entry = get_unlocked_entry(&xas); if (!entry || WARN_ON_ONCE(!xa_is_value(entry))) goto out; if (!trunc && - (radix_tree_tag_get(pages, index, PAGECACHE_TAG_DIRTY) || - radix_tree_tag_get(pages, index, PAGECACHE_TAG_TOWRITE))) + (xas_get_tag(&xas, PAGECACHE_TAG_DIRTY) || + xas_get_tag(&xas, PAGECACHE_TAG_TOWRITE))) goto out; dax_disassociate_entry(entry, mapping, trunc); - radix_tree_delete(pages, index); + xas_store(&xas, NULL); mapping->nrexceptional--; ret = 1; out: - put_unlocked_mapping_entry(mapping, index, entry); - xa_unlock_irq(pages); + put_unlocked_entry(&xas, entry); + xas_unlock_irq(&xas); return ret; } + /* * Delete DAX entry at @index from @mapping. Wait for it * to be unlocked before deleting it.