Received: by 10.213.65.68 with SMTP id h4csp351133imn; Tue, 13 Mar 2018 06:30:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELvPi58xlrq8d3EMQdm6Ad6vmZPo8J/olXx75b9PbkcpnMXvHxuPsvmYq3vrqzrJDxkxCcAH X-Received: by 10.98.61.133 with SMTP id x5mr615024pfj.181.1520947806715; Tue, 13 Mar 2018 06:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520947806; cv=none; d=google.com; s=arc-20160816; b=lCR21ZG+KYlzLiIlFmagBVhSIoPQcpzgGzWvdZesnAfO/SE+K9HwYx4G2bIbTxR0dJ 3/QaFoCDHPHnfjAtvqI1Nj+qPLVJf7Te9SDPldPKSG0eanIQZtkrpVx98xudhEh/mkcq Xe8oYgQc98Djo9OV2kdg0Bu1dYOuWofIEeqgL9jTQocSNyDoqyndNTc/RFpZJBamAlyU blBXj1vsHDWSGDf+ENqYrYtllLPdvfJSWOrU7CGlTxJA8c87NPjX/hLm2NP8Fysd7yLR B8PeUn0eUfBBeQtaV7t9zY95o32flECilXMnRY1lOqkwHJoastbhfGqQhkEuD/lj3gI7 GzyA== 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=xGmjgauUfGLydkoWQBsKenPeBTGD1flvgBvi0gn26ng=; b=AUt8HloJJWhmDqiyqQmRHq9F+tP5gPRf+mktfOJbeZMr+WPI+1mglqF9uxaTIhT2mv cdWN75cOEOLpc9DwxudijKITOD/yujYmPwzTDHU45vQKe2XRO1BVJYFJA73yfsu374Dl K/6yUGu6gQvdkDurxU5q4Ov382h6ogsLoTH8dGtGIXM5YU8Eu6ZZXaLYAhZlqSogokOJ gwa3W9TKU1JcMDj2UWX4/MK6SjSh6CMQprFCffe1vvOuyM6Mpl8TWZgKtLO6daTUZ+QK 6F+IbWf9oqKGYR/KFUKivM4taazHiDSY1xkOhJnQ6w7o3JHaUhriWTJSyttECVFGfong uYWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lcL3bJBX; 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 c87si131481pfk.369.2018.03.13.06.29.52; Tue, 13 Mar 2018 06:30:06 -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=lcL3bJBX; 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 S932882AbeCMN2X (ORCPT + 99 others); Tue, 13 Mar 2018 09:28:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35662 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932737AbeCMN1J (ORCPT ); Tue, 13 Mar 2018 09:27:09 -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=xGmjgauUfGLydkoWQBsKenPeBTGD1flvgBvi0gn26ng=; b=lcL3bJBXYfZ1QIrRrYQ0iNGKD hhM3pLtJ08HoNGXshfdDn9BGaqf3pxfSPggrr/evdbFUEO78y9HplKaXjinrqgHQvc2g2Jp1Y8Y1C cCW+cNwLJkS+kypkNP+l/Ucxw9MJVWyNYyPKxen+UPoAjUDlRfeOD5wqWnEwvKu5Jc7ndX0uWQj1k ZoPdE1WSDFXfQZsO+dvnIhHPVIOLbnrWREQxvBSc8zFglhLKcyF8Ixq97x35+UNVWVwELLQ6ZGBkW I5Ep4eY1F9IH8OiN08Hkp8JZ7IdMt2XUD+YK2k/453ym1EthlJMC8dcI5n1WFCUS3oMYMoLYcxVNk IncFAArzg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1evjxL-0004nY-Uw; Tue, 13 Mar 2018 13:27:07 +0000 From: Matthew Wilcox To: Andrew Morton Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Ryusuke Konishi , linux-nilfs@vger.kernel.org Subject: [PATCH v9 58/61] lustre: Convert to XArray Date: Tue, 13 Mar 2018 06:26:36 -0700 Message-Id: <20180313132639.17387-59-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313132639.17387-1-willy@infradead.org> References: <20180313132639.17387-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 Signed-off-by: Matthew Wilcox --- drivers/staging/lustre/lustre/llite/glimpse.c | 12 +++++------- drivers/staging/lustre/lustre/mdc/mdc_request.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/glimpse.c b/drivers/staging/lustre/lustre/llite/glimpse.c index 3075358f3f08..014035be5ac7 100644 --- a/drivers/staging/lustre/lustre/llite/glimpse.c +++ b/drivers/staging/lustre/lustre/llite/glimpse.c @@ -57,7 +57,7 @@ static const struct cl_lock_descr whole_file = { }; /* - * Check whether file has possible unwriten pages. + * Check whether file has possible unwritten pages. * * \retval 1 file is mmap-ed or has dirty pages * 0 otherwise @@ -66,16 +66,14 @@ blkcnt_t dirty_cnt(struct inode *inode) { blkcnt_t cnt = 0; struct vvp_object *vob = cl_inode2vvp(inode); - void *results[1]; - if (inode->i_mapping) - cnt += radix_tree_gang_lookup_tag(&inode->i_mapping->i_pages, - results, 0, 1, - PAGECACHE_TAG_DIRTY); + if (inode->i_mapping && xa_tagged(&inode->i_mapping->i_pages, + PAGECACHE_TAG_DIRTY)) + cnt = 1; if (cnt == 0 && atomic_read(&vob->vob_mmap_cnt) > 0) cnt = 1; - return (cnt > 0) ? 1 : 0; + return cnt; } int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 6950cb21638e..dbda8a9e351d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -931,17 +931,18 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, * hash _smaller_ than one we are looking for. */ unsigned long offset = hash_x_index(*hash, hash64); + XA_STATE(xas, &mapping->i_pages, offset); struct page *page; - int found; - xa_lock_irq(&mapping->i_pages); - found = radix_tree_gang_lookup(&mapping->i_pages, - (void **)&page, offset, 1); - if (found > 0 && !xa_is_value(page)) { + xas_lock_irq(&xas); + page = xas_find(&xas, ULONG_MAX); + if (xa_is_value(page)) + page = NULL; + if (page) { struct lu_dirpage *dp; get_page(page); - xa_unlock_irq(&mapping->i_pages); + xas_unlock_irq(&xas); /* * In contrast to find_lock_page() we are sure that directory * page cannot be truncated (while DLM lock is held) and, @@ -989,8 +990,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, page = ERR_PTR(-EIO); } } else { - xa_unlock_irq(&mapping->i_pages); - page = NULL; + xas_unlock_irq(&xas); } return page; } -- 2.16.1