]> git.baikalelectronics.ru Git - kernel.git/commitdiff
readahead: Remove read_cache_pages()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 22 Jan 2022 20:46:22 +0000 (15:46 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 1 Apr 2022 17:45:08 +0000 (13:45 -0400)
With no remaining users, remove this function and the related
infrastructure.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
include/linux/pagemap.h
mm/readahead.c

index a8d0b327b066a35997fbca1cd26a02c53e18a1f8..993994cd943a0db8a84b374cbfd791e5a61c0dd8 100644 (file)
@@ -752,8 +752,6 @@ struct page *read_cache_page(struct address_space *, pgoff_t index,
                filler_t *filler, void *data);
 extern struct page * read_cache_page_gfp(struct address_space *mapping,
                                pgoff_t index, gfp_t gfp_mask);
-extern int read_cache_pages(struct address_space *mapping,
-               struct list_head *pages, filler_t *filler, void *data);
 
 static inline struct page *read_mapping_page(struct address_space *mapping,
                                pgoff_t index, struct file *file)
index d3a47546d17d9ed618a452ad11966875d2ccd3aa..9097af639beb1a157bcc426e03ce883b5391ec8b 100644 (file)
@@ -142,82 +142,6 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
 }
 EXPORT_SYMBOL_GPL(file_ra_state_init);
 
-/*
- * see if a page needs releasing upon read_cache_pages() failure
- * - the caller of read_cache_pages() may have set PG_private or PG_fscache
- *   before calling, such as the NFS fs marking pages that are cached locally
- *   on disk, thus we need to give the fs a chance to clean up in the event of
- *   an error
- */
-static void read_cache_pages_invalidate_page(struct address_space *mapping,
-                                            struct page *page)
-{
-       if (page_has_private(page)) {
-               if (!trylock_page(page))
-                       BUG();
-               page->mapping = mapping;
-               folio_invalidate(page_folio(page), 0, PAGE_SIZE);
-               page->mapping = NULL;
-               unlock_page(page);
-       }
-       put_page(page);
-}
-
-/*
- * release a list of pages, invalidating them first if need be
- */
-static void read_cache_pages_invalidate_pages(struct address_space *mapping,
-                                             struct list_head *pages)
-{
-       struct page *victim;
-
-       while (!list_empty(pages)) {
-               victim = lru_to_page(pages);
-               list_del(&victim->lru);
-               read_cache_pages_invalidate_page(mapping, victim);
-       }
-}
-
-/**
- * read_cache_pages - populate an address space with some pages & start reads against them
- * @mapping: the address_space
- * @pages: The address of a list_head which contains the target pages.  These
- *   pages have their ->index populated and are otherwise uninitialised.
- * @filler: callback routine for filling a single page.
- * @data: private data for the callback routine.
- *
- * Hides the details of the LRU cache etc from the filesystems.
- *
- * Returns: %0 on success, error return by @filler otherwise
- */
-int read_cache_pages(struct address_space *mapping, struct list_head *pages,
-                       int (*filler)(void *, struct page *), void *data)
-{
-       struct page *page;
-       int ret = 0;
-
-       while (!list_empty(pages)) {
-               page = lru_to_page(pages);
-               list_del(&page->lru);
-               if (add_to_page_cache_lru(page, mapping, page->index,
-                               readahead_gfp_mask(mapping))) {
-                       read_cache_pages_invalidate_page(mapping, page);
-                       continue;
-               }
-               put_page(page);
-
-               ret = filler(data, page);
-               if (unlikely(ret)) {
-                       read_cache_pages_invalidate_pages(mapping, pages);
-                       break;
-               }
-               task_io_account_read(PAGE_SIZE);
-       }
-       return ret;
-}
-
-EXPORT_SYMBOL(read_cache_pages);
-
 static void read_pages(struct readahead_control *rac, struct list_head *pages,
                bool skip_page)
 {