Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4112276imm; Mon, 11 Jun 2018 07:12:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIFYiIvKlY7xvgPSN+V2UuIwYb7WVe/ZCopJUCoBHgDL8cPRMDk+sbVx6eQHiN2u1ofrYv6 X-Received: by 2002:a63:8f0d:: with SMTP id n13-v6mr15370617pgd.109.1528726337354; Mon, 11 Jun 2018 07:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726337; cv=none; d=google.com; s=arc-20160816; b=KNi2BZyqpoOYDP1K3DaW1LpPUXPYajAOrR0SeanvxWzKTVz5CXc1+pt8p7FP2wiRTb NEDhF1CRmeEYkCjfWhxlCejcNk21vVpDkoyADg/lnAgRN2DF2S01r1sOjI7kpLcNFCOE 7pgvFNb9dLAskI3RAuiwYerwfh07WEuaaTC/Pk3zOa7QDDQ85fabEIb63QviqrgAAWL/ OOTAKvode6KWpeqSPoy0PWNvYFlz8gPUrexJ4paoEbb2Lf1as3fdRuOCDB7qkYHVxD4b lVGsuzkZgY8UwMbbF+wiFZIznI/tMgrqoelN4iSP+VGijTbsoU4EnzNalUbhHtxwFAT8 sxjQ== 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=fCreVfG9TwLx1z/ixiLbiSZKlPIkYtrNKgCJWPPAZNM=; b=A5MrkygQbKGkjMWCDGH/DxlU6odCXakSQMTFBx9YY0dwVh/VJRVEWUTNBdZ91AzTFo sgHMDdQ/Q7IHYKJL4RJIIQRfG/cNKK8YSnoPtHwVunz/JcGFNBjONR56NCOUwcWpe3Sj rJ1oPwrznR+QmNQWFIyLX1cF9Ce9GlNCs2/2uuQzY20yYNNd7kGYRKZrvjKxgvK75qOp h/Xcjn9BUdzv/YB2L/DS+nZqRhCW+hrcwrpgjfLDznv9jy1eYgDkpoKxBg2KkrfEG4l2 DTCNJx/4IrFz0NmF7svSKbu1MGpCh6GHsRr/5nTwAUIJ+6rwLOMkuMh8SLNLTbi9VfnE RiPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=PwGWEwmu; 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 z25-v6si1837964pfg.184.2018.06.11.07.12.03; Mon, 11 Jun 2018 07:12:17 -0700 (PDT) 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=PwGWEwmu; 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 S933634AbeFKOLD (ORCPT + 99 others); Mon, 11 Jun 2018 10:11:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46686 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933632AbeFKOHN (ORCPT ); Mon, 11 Jun 2018 10:07:13 -0400 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- 2.17.1