Commit 7e0a1265 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle)
Browse files

mm,fs: Remove aops->readpage



With all implementations of aops->readpage converted to aops->read_folio,
we can stop checking whether it's set and remove the member from aops.

Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
parent 0f312591
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2402,7 +2402,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 && !mapping->a_ops->read_folio)
	if (!mapping->a_ops->read_folio)
		return -ENOEXEC;

	file_accessed(filp);
+1 −4
Original line number Diff line number Diff line
@@ -2827,10 +2827,7 @@ 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);
			goto out;
+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 && !mapping->a_ops->read_folio)
	if (!mapping->a_ops->read_folio)
		return -ENOEXEC;
	file_accessed(file);
	vma->vm_ops = &ceph_vmops;
+1 −2
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ struct iattr {
 *  			trying again.  The aop will be taking reasonable
 *  			precautions not to livelock.  If the caller held a page
 *  			reference, it should drop it before retrying.  Returned
 *  			by readpage().
 *  			by read_folio().
 *
 * address_space_operation functions return these large constants to indicate
 * special semantics to the caller.  These are much larger than the bytes in a
@@ -335,7 +335,6 @@ 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. */
+2 −3
Original line number Diff line number Diff line
@@ -787,10 +787,10 @@ static int __copy_insn(struct address_space *mapping, struct file *filp,
	struct page *page;
	/*
	 * Ensure that the page that has the original instruction is populated
	 * and in page-cache. If ->readpage == NULL it must be shmem_mapping(),
	 * and in page-cache. If ->read_folio == NULL it must be shmem_mapping(),
	 * see uprobe_register().
	 */
	if (mapping->a_ops->read_folio || mapping->a_ops->readpage)
	if (mapping->a_ops->read_folio)
		page = read_mapping_page(mapping, offset >> PAGE_SHIFT, filp);
	else
		page = shmem_read_mapping_page(mapping, offset >> PAGE_SHIFT);
@@ -1144,7 +1144,6 @@ static int __uprobe_register(struct inode *inode, loff_t offset,

	/* copy_insn() uses read_mapping_page() or shmem_read_mapping_page() */
	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 */
Loading