From patchwork Fri Mar 30 03:41:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10316829 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 7859060383 for ; Fri, 30 Mar 2018 03:43:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 694182873F for ; Fri, 30 Mar 2018 03:43:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D81E28791; Fri, 30 Mar 2018 03:43:01 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E57832873F for ; Fri, 30 Mar 2018 03:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752907AbeC3Dm6 (ORCPT ); Thu, 29 Mar 2018 23:42:58 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43496 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752611AbeC3Dmz (ORCPT ); Thu, 29 Mar 2018 23:42:55 -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=EOx1L4BPJFJpuhRnZv45Tpt8sej/xMf7k+ssjF5Qnps=; b=jMO+Ld8rF9ToBdbOvILRj71Q2 exGCyVNuz+Bgs5Fm/8Cybj6mwcqHbOvFSYTZOmkoVZvF/yjI4Fp/42unQ5+gTINA0kSrcY8dAOJTR R8bnThmADZLNLPrAufxzsMcysVXBQlYeFt4CMQIP5dMil909n93jyk+f9TEQMKCDLJb8p7yw/sAxt vg0SIqcvcYo5/YRnbgv8IpnOlxWDQwSilH4PtyXPNZy7nULNR98E7hb8gQNrMYK6lqKoIA7Aks1xm EoIJ/C2bQKeFNSa3z0W0WP8OKiw67uu5TfZ98oSQ9rAPUO0cxur76O8cLM2ZpvYT0NkmyelQECp8N G3ZUWEm4g==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1kwB-0002jc-QN; Fri, 30 Mar 2018 03:42:47 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, linux-fsdevel@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, Oleg Drokin , Andreas Dilger , James Simmons , Mike Kravetz Subject: [PATCH v10 01/62] page cache: Use xa_lock Date: Thu, 29 Mar 2018 20:41:44 -0700 Message-Id: <20180330034245.10462-2-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180330034245.10462-1-willy@infradead.org> References: <20180330034245.10462-1-willy@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Wilcox Remove the address_space ->tree_lock and use the xa_lock newly added to the radix_tree_root. Rename the address_space ->page_tree to ->i_pages, since we don't really care that it's a tree. Signed-off-by: Matthew Wilcox Acked-by: Jeff Layton Reviewed-by: Josef Bacik --- arch/nds32/include/asm/cacheflush.h | 4 ++-- fs/dax.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/nds32/include/asm/cacheflush.h b/arch/nds32/include/asm/cacheflush.h index 7b9b20a381cb..1240f148ec0f 100644 --- a/arch/nds32/include/asm/cacheflush.h +++ b/arch/nds32/include/asm/cacheflush.h @@ -34,8 +34,8 @@ void flush_anon_page(struct vm_area_struct *vma, void flush_kernel_dcache_page(struct page *page); void flush_icache_range(unsigned long start, unsigned long end); void flush_icache_page(struct vm_area_struct *vma, struct page *page); -#define flush_dcache_mmap_lock(mapping) spin_lock_irq(&(mapping)->tree_lock) -#define flush_dcache_mmap_unlock(mapping) spin_unlock_irq(&(mapping)->tree_lock) +#define flush_dcache_mmap_lock(mapping) xa_lock_irq(&(mapping)->i_pages) +#define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&(mapping)->i_pages) #else #include diff --git a/fs/dax.c b/fs/dax.c index eeedecc8367b..9dc7337ef571 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -584,7 +584,7 @@ static int __dax_invalidate_mapping_entry(struct address_space *mapping, void *entry; struct radix_tree_root *pages = &mapping->i_pages; - xa_lock_irq(&mapping->i_pages); + xa_lock_irq(pages); entry = get_unlocked_mapping_entry(mapping, index, NULL); if (!entry || WARN_ON_ONCE(!radix_tree_exceptional_entry(entry))) goto out; @@ -598,7 +598,7 @@ static int __dax_invalidate_mapping_entry(struct address_space *mapping, ret = 1; out: put_unlocked_mapping_entry(mapping, index, entry); - xa_unlock_irq(&mapping->i_pages); + xa_unlock_irq(pages); return ret; } /* @@ -685,7 +685,7 @@ static void *dax_insert_mapping_entry(struct address_space *mapping, unmap_mapping_pages(mapping, vmf->pgoff, 1, false); } - xa_lock_irq(&mapping->i_pages); + xa_lock_irq(pages); new_entry = dax_radix_locked_entry(pfn, flags); if (dax_entry_size(entry) != dax_entry_size(new_entry)) { dax_disassociate_entry(entry, mapping, false);