linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: linux-mm@kvack.org
Cc: linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	ceph-devel@vger.kernel.org, "Yan, Zheng" <zyan@redhat.com>,
	Ilya Dryomov <idryomov@gmail.com>, Jan Kara <jack@suse.cz>
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	[thread overview]
Message-ID: <20170914131819.26266-13-jack@suse.cz> (raw)
In-Reply-To: <20170914131819.26266-1-jack@suse.cz>

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 <jack@suse.cz>
---
 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
  */
-- 
2.12.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2017-09-14 13:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 13:18 [PATCH 0/15 v1] Ranged pagevec tagged lookup Jan Kara
2017-09-14 13:18 ` [PATCH 01/15] mm: Implement find_get_pages_range_tag() Jan Kara
2017-09-14 13:18 ` [PATCH 02/15] btrfs: Use pagevec_lookup_range_tag() Jan Kara
2017-09-14 17:57   ` David Sterba
2017-09-14 13:18 ` [PATCH 03/15] ceph: " Jan Kara
2017-09-14 13:18 ` [PATCH 04/15] ext4: " Jan Kara
2017-09-14 13:18 ` [PATCH 05/15] f2fs: " Jan Kara
2017-09-15 13:33   ` [f2fs-dev] " Chao Yu
2017-09-14 13:18 ` [PATCH 06/15] f2fs: Simplify page iteration loops Jan Kara
2017-09-15 13:37   ` [f2fs-dev] " Chao Yu
2017-09-14 13:18 ` [PATCH 07/15] f2fs: Use find_get_pages_tag() for looking up single page Jan Kara
2017-09-15 13:43   ` [f2fs-dev] " Chao Yu
2017-09-18  7:52     ` Jan Kara
2017-09-14 13:18 ` [PATCH 08/15] gfs2: Use pagevec_lookup_range_tag() Jan Kara
2017-09-14 13:18 ` [PATCH 09/15] nilfs2: " Jan Kara
2017-09-14 13:18 ` [PATCH 10/15] mm: Use pagevec_lookup_range_tag() in __filemap_fdatawait_range() Jan Kara
2017-09-14 13:18 ` [PATCH 11/15] mm: Use pagevec_lookup_range_tag() in write_cache_pages() Jan Kara
2017-09-14 13:18 ` Jan Kara [this message]
2017-09-14 13:18 ` [PATCH 13/15] ceph: Use pagevec_lookup_range_nr_tag() Jan Kara
2017-09-18  5:35   ` Yan, Zheng
2017-09-18  7:53     ` Jan Kara
2017-09-14 13:18 ` [PATCH 14/15] mm: Remove nr_pages argument from pagevec_lookup_{,range}_tag() Jan Kara
2017-09-14 13:18 ` [PATCH 15/15] afs: Use find_get_pages_range_tag() Jan Kara
2017-09-27 16:03 [PATCH 0/15 v2] Ranged pagevec tagged lookup Jan Kara
2017-09-27 16:03 ` [PATCH 12/15] mm: Add variant of pagevec_lookup_range_tag() taking number of pages Jan Kara
2017-09-29 21:45   ` Daniel Jordan
2017-10-03  8:51     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170914131819.26266-13-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zyan@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox