Commit 5efe7448 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle)
Browse files

fs: Introduce aops->read_folio



Change all the callers of ->readpage to call ->read_folio in preference,
if it exists.  This is a transitional duplication, and will be removed
by the end of the series.

Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
parent 6c2ae0d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2401,7 +2401,7 @@ static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
{
	struct address_space *mapping = filp->f_mapping;

	if (!mapping->a_ops->readpage)
	if (!mapping->a_ops->readpage && !mapping->a_ops->read_folio)
		return -ENOEXEC;

	file_accessed(filp);
+4 −1
Original line number Diff line number Diff line
@@ -2824,6 +2824,9 @@ int nobh_truncate_page(struct address_space *mapping,

	/* Ok, it's mapped. Make sure it's up-to-date */
	if (!folio_test_uptodate(folio)) {
		if (mapping->a_ops->read_folio)
			err = mapping->a_ops->read_folio(NULL, folio);
		else
			err = mapping->a_ops->readpage(NULL, &folio->page);
		if (err) {
			folio_put(folio);
+1 −1
Original line number Diff line number Diff line
@@ -1772,7 +1772,7 @@ int ceph_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->readpage && !mapping->a_ops->read_folio)
		return -ENOEXEC;
	file_accessed(file);
	vma->vm_ops = &ceph_vmops;
+1 −0
Original line number Diff line number Diff line
@@ -336,6 +336,7 @@ static inline bool is_sync_kiocb(struct kiocb *kiocb)
struct address_space_operations {
	int (*writepage)(struct page *page, struct writeback_control *wbc);
	int (*readpage)(struct file *, struct page *);
	int (*read_folio)(struct file *, struct folio *);

	/* Write back some dirty pages from this mapping. */
	int (*writepages)(struct address_space *, struct writeback_control *);
+4 −2
Original line number Diff line number Diff line
@@ -790,7 +790,7 @@ static int __copy_insn(struct address_space *mapping, struct file *filp,
	 * and in page-cache. If ->readpage == NULL it must be shmem_mapping(),
	 * see uprobe_register().
	 */
	if (mapping->a_ops->readpage)
	if (mapping->a_ops->read_folio || mapping->a_ops->readpage)
		page = read_mapping_page(mapping, offset >> PAGE_SHIFT, filp);
	else
		page = shmem_read_mapping_page(mapping, offset >> PAGE_SHIFT);
@@ -1143,7 +1143,9 @@ static int __uprobe_register(struct inode *inode, loff_t offset,
		return -EINVAL;

	/* copy_insn() uses read_mapping_page() or shmem_read_mapping_page() */
	if (!inode->i_mapping->a_ops->readpage && !shmem_mapping(inode->i_mapping))
	if (!inode->i_mapping->a_ops->read_folio &&
	    !inode->i_mapping->a_ops->readpage &&
	    !shmem_mapping(inode->i_mapping))
		return -EIO;
	/* Racy, just to catch the obvious mistakes */
	if (offset > i_size_read(inode))
Loading