Received: by 10.223.185.116 with SMTP id b49csp4145888wrg; Mon, 19 Feb 2018 12:01:04 -0800 (PST) X-Google-Smtp-Source: AH8x225mu6nrDB+a1ETgfVFsf25dBZ+KUU3cunAJAREw8CGARNOHv83Y3ogYTXQyp3utz0Uczq9w X-Received: by 10.98.247.9 with SMTP id h9mr15695543pfi.212.1519070464176; Mon, 19 Feb 2018 12:01:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519070464; cv=none; d=google.com; s=arc-20160816; b=i1auQJyoMQkNDMyzqQb++BizZQQRmoNApzG6a9mLvvCW1D3fFO4TNHG1oHPISFiN/u t6E6l3+BvBS94MX6AEIBxniU/MHPiBhv07vX1A26OpDgYIj6/MPnQjDRChapXIVuXWMQ o5nqxhmmpPn/QGk5l4i0WNcHhxdVEp5i7Hoj00oAOkk1aQUyilxaU1YybU8A0oKaZjw3 iOijK6KKzKuZqxmOIon8IaTtvI12buaRlEzNnKq0KZ4RJwlXRckHr4AqKYIWsrbBO0eZ nbKh1dncu3jSo9ZGFAGq5z1jNUpzlFlJsjQeNHYaBuMLj++8ffzYxpkXvPmaX6SV6ZO/ UKNA== 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=S38F5zJ8iUJHb4zYxKS9+drgIRbRT3fQITIxvzXxgkY=; b=rSb/H1rdIt+IJXiC3ZsdCLPvQaZcAAz9KELZ+tgz4AqeagLw4v27OorL94x57FTbIJ hk+QqICOe+X/jC3hVTfbx+j3BPyNp+pGfm3oMwgBMP4R1fRgG+Rry7OJonXQhP6ETdxB s4xtVUvjNQdHaFFJpdewYNFeyLQd5zLKF9wfemDndeyvRbC7IUnmqiosLxlyNECnIxOz 3eo1PSPY8E2Tp0UgRsiW+X1FEPlXUZXnLCU07H7tbpskljM0Q/QxmApSPyojuvzpWX/2 WTV4Z9FY3AG5+Bw81yhkvRUaEkTc5879vU6eoo1xZFqBQKRfCKuq6Kk2bVJRDzuJN4FU ppIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DDXTdk9Z; 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 a64si4596270pfb.405.2018.02.19.12.00.49; Mon, 19 Feb 2018 12:01:04 -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=DDXTdk9Z; 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 S1754006AbeBST5F (ORCPT + 99 others); Mon, 19 Feb 2018 14:57:05 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:44792 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753715AbeBSTqS (ORCPT ); Mon, 19 Feb 2018 14:46:18 -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=S38F5zJ8iUJHb4zYxKS9+drgIRbRT3fQITIxvzXxgkY=; b=DDXTdk9Z22nwbpxK6h7zt1AdI l2zz+0apFrzUFoefk5WZCqW0dOf+WRK/qFFH4JqZEv9vVZfiPhCZ701jWAjAvjIk94E6AmuiStdGs 2xf6qwzo5snA+CqXyeJmG//ks5oSoNJMrQRJeg7s58ncoGwWIe2mwYH4bV32YBsCwVqUEk0rYUFD9 G4OyGYv+L8g94eMxZwDZ0sCQJOQnip+FZRn56t7SVGC6G5/+Or/f2H/AeeVILIR0OI3eVeq4jaq4q /DZdbwx2iJyzSTPIjkNy+yHdOLWBzTnF3rxAwfK/7D5MmnvI6QiBpP8rEDBLAK9fEu+rvP47vMob4 soiPuALoA==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1enrOD-0001pZ-Ek; Mon, 19 Feb 2018 19:46:17 +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 32/61] page cache: Convert filemap_range_has_page to XArray Date: Mon, 19 Feb 2018 11:45:27 -0800 Message-Id: <20180219194556.6575-33-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 Instead of calling find_get_pages_range() and putting any reference, just use xa_find() to look for a page in the right range. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 3735ea6e3d19..a02d69a957e4 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -460,18 +460,11 @@ bool filemap_range_has_page(struct address_space *mapping, { pgoff_t index = start_byte >> PAGE_SHIFT; pgoff_t end = end_byte >> PAGE_SHIFT; - struct page *page; if (end_byte < start_byte) return false; - if (mapping->nrpages == 0) - return false; - - if (!find_get_pages_range(mapping, &index, end, 1, &page)) - return false; - put_page(page); - return true; + return xa_find(&mapping->pages, &index, end, XA_PRESENT); } EXPORT_SYMBOL(filemap_range_has_page); -- 2.16.1