Skip to content

Commit

Permalink
mm/filemap: don't cast ->readpage to filler_t for do_read_cache_page
Browse files Browse the repository at this point in the history
We can just pass a NULL filler and do the right thing inside of
do_read_cache_page based on the NULL parameter.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Sami Tolvanen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig authored and torvalds committed Jul 12, 2019
1 parent d322a8e commit 6c45b45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions include/linux/pagemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ extern int read_cache_pages(struct address_space *mapping,
static inline struct page *read_mapping_page(struct address_space *mapping,
pgoff_t index, void *data)
{
filler_t *filler = (filler_t *)mapping->a_ops->readpage;
return read_cache_page(mapping, index, filler, data);
return read_cache_page(mapping, index, NULL, data);
}

/*
Expand Down
10 changes: 6 additions & 4 deletions mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2825,7 +2825,11 @@ static struct page *do_read_cache_page(struct address_space *mapping,
}

filler:
err = filler(data, page);
if (filler)
err = filler(data, page);
else
err = mapping->a_ops->readpage(data, page);

if (err < 0) {
put_page(page);
return ERR_PTR(err);
Expand Down Expand Up @@ -2937,9 +2941,7 @@ struct page *read_cache_page_gfp(struct address_space *mapping,
pgoff_t index,
gfp_t gfp)
{
filler_t *filler = (filler_t *)mapping->a_ops->readpage;

return do_read_cache_page(mapping, index, filler, NULL, gfp);
return do_read_cache_page(mapping, index, NULL, NULL, gfp);
}
EXPORT_SYMBOL(read_cache_page_gfp);

Expand Down

0 comments on commit 6c45b45

Please sign in to comment.