Received: by 10.223.185.116 with SMTP id b49csp4138255wrg; Mon, 19 Feb 2018 11:51:52 -0800 (PST) X-Google-Smtp-Source: AH8x227Gf2A0fqdhCIupX4IwV+jO5GkVMpTJxYdysf4exZbr7aKm7B+Fy/o3VFyXzZbL1JPM3ZWT X-Received: by 10.99.43.73 with SMTP id r70mr13485210pgr.316.1519069912083; Mon, 19 Feb 2018 11:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519069912; cv=none; d=google.com; s=arc-20160816; b=yYWg59Kn+42DT1p4rVqNBhiZYCqsstyenKzybrRCACD7LHUQm2ezupCak+b6TVLjLj UZJn/AXF39TxTQeG0OpTwrURZN4aJP7YWlRGTQjw4zbgQ6y0uAYS0tofcxyllcJlhtxe H0f4hfr1FN8VuSxFgjmxF8SseUQiZ3Z5vTmqJWbLZ4eGgi7ZhKCIvRXR69Wpb6t63KUe vY031Cmg5/tdsnjZH3gSQ/cTcbsEErR+kKOWjLc2f3JJ1t7fadqc9qhje7ZMjE3G002Y G6anm0taltytyQTJhrvQQ7X4lV+uUbmMst5j1/QhCQLjHue/lVtSz/rs5y/vOOO1t9R9 QkGw== 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=NCWuugKhX3z5Y98O++4g8DsH5RXM7uzkvdnl/+D7J28=; b=KYOTaIWa9FWtOO7XLkshvi1pKp8Sz337TnjYVGEZ2T92E2/T0iZ3NDJOBXSewZQO+K jv5qAIug3NAAoSzS0zC/oE8z5V+ZAJcmm66WpwKCcpsHXNTDBD/z8qWZS3WUSgOnD8BW KAEnUJVGOzWBwlOAVTKNTCb1Zr5N4WchWKfL+8XedBuVkNuznGyWj/f3RAbMJWEEVcot u9UNqJL/C05BF+khYWMwakHvM6DCAiPjzOGPLpc1fQSwFTQBgIVPA/e9dkUoNEQWl2A/ 3uu6pSQux6BxQwZBfU+kIddldOkJe12TKwRKdq8sOUTHPC5m7sL7pBh4bVcYvGprbod6 96OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=itMCjzE0; 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 s87si6286004pfj.396.2018.02.19.11.51.37; Mon, 19 Feb 2018 11:51:52 -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=itMCjzE0; 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 S1753892AbeBSTtC (ORCPT + 99 others); Mon, 19 Feb 2018 14:49:02 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:45088 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753822AbeBSTqc (ORCPT ); Mon, 19 Feb 2018 14:46:32 -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=NCWuugKhX3z5Y98O++4g8DsH5RXM7uzkvdnl/+D7J28=; b=itMCjzE0wdHW378Ccua6fw5zB AexY2eKOd5ewhJNxHiEuiZ/ivupTKk9gbTLKxyzFDGKwMPoCOJ+/qKzwrh7x8i6W8Qd9VoByfgoRP M3d0JIFt37z8srVuZjhkFMO3/oiRwzc++rZJ1r+82tSsZ+IHn31ARHYQE0tOhVLEER6Gmk0nVnenw uFzIt7oeVwGA5FLl6GLQ5D6GD9Sk+hwYlxuTf7yeWD5nkus5QhLseKCt46xc9p/VvPEeRppQ21DOn uKz3ORI7XIOANMUhBFBhgms23+lrrL2NJSfe5yFnHDeK0fk1gpIrRQIJvO5DgTYP+owi2OvTNd7wW UOEp2t7cQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1enrOR-0001xS-6y; Mon, 19 Feb 2018 19:46:31 +0000 From: Matthew Wilcox To: Andrew Morton Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 59/61] lustre: Convert to XArray Date: Mon, 19 Feb 2018 11:45:54 -0800 Message-Id: <20180219194556.6575-60-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180219194556.6575-1-willy@infradead.org> References: <20180219194556.6575-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.16.1