Skip to content

Commit ebf921a

Browse files
author
Matthew Wilcox (Oracle)
committed
readahead: Remove read_cache_pages()
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>
1 parent d888c83 commit ebf921a

2 files changed

Lines changed: 0 additions & 78 deletions

File tree

include/linux/pagemap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,6 @@ struct page *read_cache_page(struct address_space *, pgoff_t index,
752752
filler_t *filler, void *data);
753753
extern struct page * read_cache_page_gfp(struct address_space *mapping,
754754
pgoff_t index, gfp_t gfp_mask);
755-
extern int read_cache_pages(struct address_space *mapping,
756-
struct list_head *pages, filler_t *filler, void *data);
757755

758756
static inline struct page *read_mapping_page(struct address_space *mapping,
759757
pgoff_t index, struct file *file)

mm/readahead.c

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -142,82 +142,6 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
142142
}
143143
EXPORT_SYMBOL_GPL(file_ra_state_init);
144144

145-
/*
146-
* see if a page needs releasing upon read_cache_pages() failure
147-
* - the caller of read_cache_pages() may have set PG_private or PG_fscache
148-
* before calling, such as the NFS fs marking pages that are cached locally
149-
* on disk, thus we need to give the fs a chance to clean up in the event of
150-
* an error
151-
*/
152-
static void read_cache_pages_invalidate_page(struct address_space *mapping,
153-
struct page *page)
154-
{
155-
if (page_has_private(page)) {
156-
if (!trylock_page(page))
157-
BUG();
158-
page->mapping = mapping;
159-
folio_invalidate(page_folio(page), 0, PAGE_SIZE);
160-
page->mapping = NULL;
161-
unlock_page(page);
162-
}
163-
put_page(page);
164-
}
165-
166-
/*
167-
* release a list of pages, invalidating them first if need be
168-
*/
169-
static void read_cache_pages_invalidate_pages(struct address_space *mapping,
170-
struct list_head *pages)
171-
{
172-
struct page *victim;
173-
174-
while (!list_empty(pages)) {
175-
victim = lru_to_page(pages);
176-
list_del(&victim->lru);
177-
read_cache_pages_invalidate_page(mapping, victim);
178-
}
179-
}
180-
181-
/**
182-
* read_cache_pages - populate an address space with some pages & start reads against them
183-
* @mapping: the address_space
184-
* @pages: The address of a list_head which contains the target pages. These
185-
* pages have their ->index populated and are otherwise uninitialised.
186-
* @filler: callback routine for filling a single page.
187-
* @data: private data for the callback routine.
188-
*
189-
* Hides the details of the LRU cache etc from the filesystems.
190-
*
191-
* Returns: %0 on success, error return by @filler otherwise
192-
*/
193-
int read_cache_pages(struct address_space *mapping, struct list_head *pages,
194-
int (*filler)(void *, struct page *), void *data)
195-
{
196-
struct page *page;
197-
int ret = 0;
198-
199-
while (!list_empty(pages)) {
200-
page = lru_to_page(pages);
201-
list_del(&page->lru);
202-
if (add_to_page_cache_lru(page, mapping, page->index,
203-
readahead_gfp_mask(mapping))) {
204-
read_cache_pages_invalidate_page(mapping, page);
205-
continue;
206-
}
207-
put_page(page);
208-
209-
ret = filler(data, page);
210-
if (unlikely(ret)) {
211-
read_cache_pages_invalidate_pages(mapping, pages);
212-
break;
213-
}
214-
task_io_account_read(PAGE_SIZE);
215-
}
216-
return ret;
217-
}
218-
219-
EXPORT_SYMBOL(read_cache_pages);
220-
221145
static void read_pages(struct readahead_control *rac, struct list_head *pages,
222146
bool skip_page)
223147
{

0 commit comments

Comments
 (0)