linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org,
	linux-nilfs@vger.kernel.org
Subject: [PATCH 10/10] filemap: Remove find_get_pages_range() and associated functions
Date: Sun,  5 Jun 2022 20:38:54 +0100	[thread overview]
Message-ID: <20220605193854.2371230-11-willy@infradead.org> (raw)
In-Reply-To: <20220605193854.2371230-1-willy@infradead.org>

All callers of find_get_pages_range(), pagevec_lookup_range() and
pagevec_lookup() have now been removed.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/pagemap.h |  3 --
 include/linux/pagevec.h | 10 ------
 mm/filemap.c            | 67 -----------------------------------------
 mm/swap.c               | 29 ------------------
 4 files changed, 109 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 50e57b2d845f..1caccb9f99aa 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -720,9 +720,6 @@ static inline struct page *find_subpage(struct page *head, pgoff_t index)
 
 unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
 		pgoff_t end, struct folio_batch *fbatch);
-unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start,
-			pgoff_t end, unsigned int nr_pages,
-			struct page **pages);
 unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
 			       unsigned int nr_pages, struct page **pages);
 unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index,
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 67b1246f136b..6649154a2115 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -27,16 +27,6 @@ struct pagevec {
 
 void __pagevec_release(struct pagevec *pvec);
 void __pagevec_lru_add(struct pagevec *pvec);
-unsigned pagevec_lookup_range(struct pagevec *pvec,
-			      struct address_space *mapping,
-			      pgoff_t *start, pgoff_t end);
-static inline unsigned pagevec_lookup(struct pagevec *pvec,
-				      struct address_space *mapping,
-				      pgoff_t *start)
-{
-	return pagevec_lookup_range(pvec, mapping, start, (pgoff_t)-1);
-}
-
 unsigned pagevec_lookup_range_tag(struct pagevec *pvec,
 		struct address_space *mapping, pgoff_t *index, pgoff_t end,
 		xa_mark_t tag);
diff --git a/mm/filemap.c b/mm/filemap.c
index ea4145b7a84c..340ccb37f6b6 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2192,73 +2192,6 @@ bool folio_more_pages(struct folio *folio, pgoff_t index, pgoff_t max)
 	return index < folio->index + folio_nr_pages(folio) - 1;
 }
 
-/**
- * find_get_pages_range - gang pagecache lookup
- * @mapping:	The address_space to search
- * @start:	The starting page index
- * @end:	The final page index (inclusive)
- * @nr_pages:	The maximum number of pages
- * @pages:	Where the resulting pages are placed
- *
- * find_get_pages_range() will search for and return a group of up to @nr_pages
- * pages in the mapping starting at index @start and up to index @end
- * (inclusive).  The pages are placed at @pages.  find_get_pages_range() takes
- * a reference against the returned pages.
- *
- * The search returns a group of mapping-contiguous pages with ascending
- * indexes.  There may be holes in the indices due to not-present pages.
- * We also update @start to index the next page for the traversal.
- *
- * Return: the number of pages which were found. If this number is
- * smaller than @nr_pages, the end of specified range has been
- * reached.
- */
-unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start,
-			      pgoff_t end, unsigned int nr_pages,
-			      struct page **pages)
-{
-	XA_STATE(xas, &mapping->i_pages, *start);
-	struct folio *folio;
-	unsigned ret = 0;
-
-	if (unlikely(!nr_pages))
-		return 0;
-
-	rcu_read_lock();
-	while ((folio = find_get_entry(&xas, end, XA_PRESENT))) {
-		/* Skip over shadow, swap and DAX entries */
-		if (xa_is_value(folio))
-			continue;
-
-again:
-		pages[ret] = folio_file_page(folio, xas.xa_index);
-		if (++ret == nr_pages) {
-			*start = xas.xa_index + 1;
-			goto out;
-		}
-		if (folio_more_pages(folio, xas.xa_index, end)) {
-			xas.xa_index++;
-			folio_ref_inc(folio);
-			goto again;
-		}
-	}
-
-	/*
-	 * We come here when there is no page beyond @end. We take care to not
-	 * overflow the index @start as it confuses some of the callers. This
-	 * breaks the iteration when there is a page at index -1 but that is
-	 * already broken anyway.
-	 */
-	if (end == (pgoff_t)-1)
-		*start = (pgoff_t)-1;
-	else
-		*start = end + 1;
-out:
-	rcu_read_unlock();
-
-	return ret;
-}
-
 /**
  * find_get_pages_contig - gang contiguous pagecache lookup
  * @mapping:	The address_space to search
diff --git a/mm/swap.c b/mm/swap.c
index f3922a96b2e9..f65e284247b2 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -1086,35 +1086,6 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch)
 	fbatch->nr = j;
 }
 
-/**
- * pagevec_lookup_range - gang pagecache lookup
- * @pvec:	Where the resulting pages are placed
- * @mapping:	The address_space to search
- * @start:	The starting page index
- * @end:	The final page index
- *
- * pagevec_lookup_range() will search for & return a group of up to PAGEVEC_SIZE
- * pages in the mapping starting from index @start and upto index @end
- * (inclusive).  The pages are placed in @pvec.  pagevec_lookup() takes a
- * reference against the pages in @pvec.
- *
- * The search returns a group of mapping-contiguous pages with ascending
- * indexes.  There may be holes in the indices due to not-present pages. We
- * also update @start to index the next page for the traversal.
- *
- * pagevec_lookup_range() returns the number of pages which were found. If this
- * number is smaller than PAGEVEC_SIZE, the end of specified range has been
- * reached.
- */
-unsigned pagevec_lookup_range(struct pagevec *pvec,
-		struct address_space *mapping, pgoff_t *start, pgoff_t end)
-{
-	pvec->nr = find_get_pages_range(mapping, start, end, PAGEVEC_SIZE,
-					pvec->pages);
-	return pagevec_count(pvec);
-}
-EXPORT_SYMBOL(pagevec_lookup_range);
-
 unsigned pagevec_lookup_range_tag(struct pagevec *pvec,
 		struct address_space *mapping, pgoff_t *index, pgoff_t end,
 		xa_mark_t tag)
-- 
2.35.1


  parent reply	other threads:[~2022-06-05 19:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-05 19:38 [PATCH 00/10] Convert to filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-05 19:38 ` [PATCH 01/10] filemap: Add filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-08  8:00   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 02/10] buffer: Convert clean_bdev_aliases() to use filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-08  8:01   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 03/10] ext4: Convert mpage_release_unused_pages() " Matthew Wilcox (Oracle)
2022-06-08  8:02   ` Christoph Hellwig
2022-06-08 16:02     ` Matthew Wilcox
2022-06-09  3:55       ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 04/10] ext4: Convert mpage_map_and_submit_buffers() " Matthew Wilcox (Oracle)
2022-06-08  8:03   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 05/10] f2fs: Convert f2fs_invalidate_compress_pages() " Matthew Wilcox (Oracle)
2022-06-08  8:03   ` Christoph Hellwig
2022-06-15  8:14   ` [f2fs-dev] " Chao Yu
2022-06-05 19:38 ` [PATCH 06/10] hugetlbfs: Convert remove_inode_hugepages() " Matthew Wilcox (Oracle)
2022-06-08  8:04   ` Christoph Hellwig
2022-06-10 15:52   ` Sumanth Korikkar
2022-06-10 18:35     ` Gerald Schaefer
2022-06-10 21:17     ` Matthew Wilcox
2022-06-10 21:56       ` Mike Kravetz
2022-06-13  6:56       ` Sumanth Korikkar
2022-06-05 19:38 ` [PATCH 07/10] nilfs2: Convert nilfs_copy_back_pages() " Matthew Wilcox (Oracle)
2022-06-07 16:10   ` Ryusuke Konishi
2022-06-08  8:04   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 08/10] vmscan: Add check_move_unevictable_folios() Matthew Wilcox (Oracle)
2022-06-08  8:07   ` Christoph Hellwig
2022-06-08 16:32     ` Matthew Wilcox
2022-06-09  3:56       ` Christoph Hellwig
2022-06-08 15:33   ` [vmscan] bc9eb0d5ef: BUG:KASAN:stack-out-of-bounds_in_check_move_unevictable_pages kernel test robot
2022-06-05 19:38 ` [PATCH 09/10] shmem: Convert shmem_unlock_mapping() to use filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-08  8:08   ` Christoph Hellwig
2022-06-05 19:38 ` Matthew Wilcox (Oracle) [this message]
2022-06-08  8:08   ` [PATCH 10/10] filemap: Remove find_get_pages_range() and associated functions Christoph Hellwig
2022-06-07 11:37 ` [PATCH 00/10] Convert to filemap_get_folios() Christian Brauner

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=20220605193854.2371230-11-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nilfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).