aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index c15cfc28f9ce..96e3d7ffd98e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2419,7 +2419,10 @@ static int filemap_read_folio(struct file *file, struct address_space *mapping,
*/
folio_clear_error(folio);
/* Start the actual read. The read will unlock the page. */
- error = mapping->a_ops->readpage(file, &folio->page);
+ if (mapping->a_ops->read_folio)
+ error = mapping->a_ops->read_folio(file, folio);
+ else
+ error = mapping->a_ops->readpage(file, &folio->page);
if (error)
return error;
@@ -3447,7 +3450,7 @@ int generic_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct address_space *mapping = file->f_mapping;
- if (!mapping->a_ops->readpage)
+ if (!mapping->a_ops->read_folio && !mapping->a_ops->readpage)
return -ENOEXEC;
file_accessed(file);
vma->vm_ops = &generic_file_vm_ops;
@@ -3505,6 +3508,8 @@ repeat:
filler:
if (filler)
err = filler(data, &folio->page);
+ else if (mapping->a_ops->read_folio)
+ err = mapping->a_ops->read_folio(data, folio);
else
err = mapping->a_ops->readpage(data, &folio->page);