@@ -2834,18 +2834,6 @@ EXPORT_SYMBOL(filemap_page_mkwrite);
EXPORT_SYMBOL(generic_file_mmap);
EXPORT_SYMBOL(generic_file_readonly_mmap);
-static struct page *wait_on_page_read(struct page *page)
-{
- if (!IS_ERR(page)) {
- wait_on_page_locked(page);
- if (!PageUptodate(page)) {
- put_page(page);
- page = ERR_PTR(-EIO);
- }
- }
- return page;
-}
-
static struct page *do_read_cache_page(struct address_space *mapping,
pgoff_t index,
int (*filler)(void *, struct page *),
@@ -2876,7 +2864,10 @@ static struct page *do_read_cache_page(struct address_space *mapping,
err = mapping->a_ops->readpage(data, page);
if (err == AOP_UPDATED_PAGE) {
unlock_page(page);
- goto out;
+ } else if (!err) {
+ wait_on_page_locked(page);
+ if (!PageUptodate(page))
+ err = -EIO;
}
if (err < 0) {
@@ -2884,9 +2875,6 @@ static struct page *do_read_cache_page(struct address_space *mapping,
return ERR_PTR(err);
}
- page = wait_on_page_read(page);
- if (IS_ERR(page))
- return page;
goto out;
}
if (PageUptodate(page))
Having this code inline helps the function read more easily. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- mm/filemap.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)