Received: by 10.223.148.5 with SMTP id 5csp6369181wrq; Wed, 17 Jan 2018 12:46:54 -0800 (PST) X-Google-Smtp-Source: ACJfBos0PtaOLfKfCMCfmHjtFhVvt/Krj9xi/CnxaJ/BRxOlSo5cP/T0tlv8L0TSeA0POIfjtLgW X-Received: by 10.84.143.131 with SMTP id 3mr23786145plz.385.1516222014396; Wed, 17 Jan 2018 12:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516222014; cv=none; d=google.com; s=arc-20160816; b=VXMfJzY7WC0mgNq9fVxDixvK8tPAMe4ZNYlltoWMSTWmWktONYNX4pMv7S8xgiOiaN Cx6nP9y7ChrSe8VPnlMMIHEZ9ciYH/I2rJ9Ms1vBdfiQBmrDLSUlngtyO29kucaaX9t5 k/TZ3srJhzmmC+JOfOb6jqhynpbxxRigk11LgcHmRcMTOJ3gvnuYlxIXXsASI7I8YMja EDiaW1wfGzcAcSeidVwqLirI0lDpSqsGAxbO5Tg1+ZPnGDTZgR1IZ5f08xwUmpcsmLpZ bMySTJFOwampJ/yRJB7U4e/xmtMNok2Fn09N0zohSBUEeH09X2fcaBjQP24w/3Ao8/fX WEHA== 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=iUwoT2jTeIJDsbftyjZLSRZC7V1QinGj9JYk3Mn7QX8=; b=qUxmIF0r8+qouqnA7+GbkM6NVJCKI3gpm1xeFxT6k9lfMNVhRmv9Vfxp98TT3RWksq vfwZ647/V8/mpm12get9tHbgvto5yPYDerNC5OstXGW6NNDJgc/0z3+SxKOx5LbSyRqd slbtXtE5Sxb+i31YZPeYKIXJMWwW1cjzAvssPu9qqyIoEx8WEH/E2lTifVkXeWVzuHil I/tIgvY044m9hVBH52C4aK+kijLBuoBvhLhYjRSQIduXKYXcOGjfaSaiAtcKauSajuxU rU+HepvSAtVJmgXGRi74WfcMtxd9752I8Mk2jGNYKo/WTVKPzr/3paYtxGPUu6OU4LZg XXQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ENbgxJ/j; 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 f64si5209015plf.473.2018.01.17.12.46.40; Wed, 17 Jan 2018 12:46:54 -0800 (PST) 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=ENbgxJ/j; 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 S932082AbeAQUqK (ORCPT + 99 others); Wed, 17 Jan 2018 15:46:10 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:58131 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695AbeAQUWu (ORCPT ); Wed, 17 Jan 2018 15:22:50 -0500 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=iUwoT2jTeIJDsbftyjZLSRZC7V1QinGj9JYk3Mn7QX8=; b=ENbgxJ/jg4N43jTx44ed+TvuI EW5NjE29BwdXnecGQhizta8ft7CZOB/s9K65D6skhJ2mDGfgt35kCotpewkfY+Oa3nVtf0XsQQ/Ns QkOo87z5GhhOiKdvddFWO3zsVNSZ4iiKwlNvX8ArtEilj/sT2/qY8GyJb+mXm74S4D+z5YPGv/8Ot aplj4sOEAJH9ftsCeEpWOTTBXgIMm0lTMMGsOqnoWhvvp99D951yWSjq2tVveMo4ToVWtEcwYjeun S7o9D2ZnUDfhzJqgByfA+fKCa4bfvz0VKmAPlIDAkF2rWoCHKR+Sn74La2sqfDGtj0/pj61zqM40G pIMhdQacA==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ebuES-00062A-IA; Wed, 17 Jan 2018 20:22:48 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-nilfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-usb@vger.kernel.org, Bjorn Andersson , Stefano Stabellini , iommu@lists.linux-foundation.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, intel-gfx@lists.freedesktop.org, cgroups@vger.kernel.org, linux-sh@vger.kernel.org, David Howells Subject: [PATCH v6 56/99] lustre: Convert to XArray Date: Wed, 17 Jan 2018 12:21:20 -0800 Message-Id: <20180117202203.19756-57-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180117202203.19756-1-willy@infradead.org> References: <20180117202203.19756-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 5f2843da911c..25232fdf5797 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->pages, - results, 0, 1, - PAGECACHE_TAG_DIRTY); + if (inode->i_mapping && xa_tagged(&inode->i_mapping->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 2ec79a6b17da..ea23247e9e02 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -934,17 +934,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->pages, offset); struct page *page; - int found; - xa_lock_irq(&mapping->pages); - found = radix_tree_gang_lookup(&mapping->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->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, @@ -992,8 +993,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, page = ERR_PTR(-EIO); } } else { - xa_unlock_irq(&mapping->pages); - page = NULL; + xas_unlock_irq(&xas); } return page; } -- 2.15.1