Commit cb33cf00 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] check for presence of readpage() in the readahead code

Make sure that the address_space is capable of performing the readahead
before going in and allocating the pages.
parent b068fc92
...@@ -260,6 +260,9 @@ int do_page_cache_readahead(struct address_space *mapping, struct file *filp, ...@@ -260,6 +260,9 @@ int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
{ {
int ret = 0; int ret = 0;
if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
return -EINVAL;
while (nr_to_read) { while (nr_to_read) {
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment