From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.codeaurora.org by pdx-caf-mail.web.codeaurora.org (Dovecot) with LMTP id x+qaBH98HlsAUAAAmS7hNA ; Mon, 11 Jun 2018 14:11:06 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DB91E60791; Mon, 11 Jun 2018 14:11:05 +0000 (UTC) Authentication-Results: smtp.codeaurora.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PwGWEwmu" X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-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,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by smtp.codeaurora.org (Postfix) with ESMTP id 5B682600D0; Mon, 11 Jun 2018 14:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5B682600D0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933652AbeFKOLE (ORCPT + 19 others); Mon, 11 Jun 2018 10:11:04 -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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox 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> References: <20180611140639.17215-1-willy@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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=fjq8x++ouR6kx2OEx77mcqwA38 hEbmVTgnn/kvHBVd/OydnpJXODG0lASqRxV6ZwDfZnQV2lzWoorU4Oa29Pxygxuoxp+E5h9KVfDxY mFZHWRt6qBNfpqkS5AFdzaNC5QU0AwikK2mioOtb/R2g5lUNhFk37nEI5G0OJei/d24c=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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=a3r4UiheV34Mp44jcSV71p3jna PYQSwreQi2N02Sd8fS75rzwIMjqM7bj19XPYkRy0nYjZvkl0fenLNMxhUNxo0lHBYLYYGPgRcFroO 1RnJp60pXoPwUwv64JH3RNQW8zPp7xA1nrR9djKjASC5CMcDavlQJ1c4ylN9Mxd/vnlE=; 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==; In-Reply-To: <20180611140639.17215-1-willy@infradead.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-nilfs@vger.kernel.org, Jan Kara , Jeff Layton , Matthew Wilcox , Jaegeuk Kim , Nicholas Piggin , linux-f2fs-devel@lists.sourceforge.net, Ryusuke Konishi , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues 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 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot