From patchwork Thu Sep 14 13:18:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9953057 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 AD23260230 for ; Thu, 14 Sep 2017 13:19:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8725028CD3 for ; Thu, 14 Sep 2017 13:19:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BF6928D27; Thu, 14 Sep 2017 13:19:13 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 27B3B28CD3 for ; Thu, 14 Sep 2017 13:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751529AbdINNTK (ORCPT ); Thu, 14 Sep 2017 09:19:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:34085 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751335AbdINNSk (ORCPT ); Thu, 14 Sep 2017 09:18:40 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DB929ACFF; Thu, 14 Sep 2017 13:18:37 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id D6EB11E34D0; Thu, 14 Sep 2017 15:18:36 +0200 (CEST) From: Jan Kara To: Cc: , linux-f2fs-devel@lists.sourceforge.net, Jaegeuk Kim , ceph-devel@vger.kernel.org, "Yan, Zheng" , Ilya Dryomov , Jan Kara Subject: [PATCH 12/15] mm: Add variant of pagevec_lookup_range_tag() taking number of pages Date: Thu, 14 Sep 2017 15:18:16 +0200 Message-Id: <20170914131819.26266-13-jack@suse.cz> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170914131819.26266-1-jack@suse.cz> References: <20170914131819.26266-1-jack@suse.cz> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently pagevec_lookup_range_tag() takes number of pages to look up but most users don't need this. Create a new function pagevec_lookup_range_nr_tag() that takes maximum number of pages to lookup for Ceph which wants this functionality so that we can drop nr_pages argument from pagevec_lookup_range_tag(). Signed-off-by: Jan Kara --- include/linux/pagevec.h | 3 +++ mm/swap.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 371edacc10d5..0281b1d3a91b 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -40,6 +40,9 @@ static inline unsigned pagevec_lookup(struct pagevec *pvec, unsigned pagevec_lookup_range_tag(struct pagevec *pvec, struct address_space *mapping, pgoff_t *index, pgoff_t end, int tag, unsigned nr_pages); +unsigned pagevec_lookup_range_nr_tag(struct pagevec *pvec, + struct address_space *mapping, pgoff_t *index, pgoff_t end, + int tag, unsigned max_pages); static inline unsigned pagevec_lookup_tag(struct pagevec *pvec, struct address_space *mapping, pgoff_t *index, int tag, unsigned nr_pages) diff --git a/mm/swap.c b/mm/swap.c index a00065f2a8f2..97186da8e5bd 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -996,6 +996,15 @@ unsigned pagevec_lookup_range_tag(struct pagevec *pvec, } EXPORT_SYMBOL(pagevec_lookup_range_tag); +unsigned pagevec_lookup_range_nr_tag(struct pagevec *pvec, + struct address_space *mapping, pgoff_t *index, pgoff_t end, + int tag, unsigned max_pages) +{ + pvec->nr = find_get_pages_range_tag(mapping, index, end, tag, + min_t(unsigned int, max_pages, PAGEVEC_SIZE), pvec->pages); + return pagevec_count(pvec); +} +EXPORT_SYMBOL(pagevec_lookup_range_tag); /* * Perform any setup for the swap system */