Commit 12acf4fb authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

userfaultfd: convert mcontinue_atomic_pte() to use a folio

shmem_getpage() is being replaced by shmem_get_folio() so use a folio
throughout this function.  Saves several calls to compound_head().

Link: https://lkml.kernel.org/r/20220902194653.1739778-33-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 7459c149
...@@ -243,20 +243,22 @@ static int mcontinue_atomic_pte(struct mm_struct *dst_mm, ...@@ -243,20 +243,22 @@ static int mcontinue_atomic_pte(struct mm_struct *dst_mm,
{ {
struct inode *inode = file_inode(dst_vma->vm_file); struct inode *inode = file_inode(dst_vma->vm_file);
pgoff_t pgoff = linear_page_index(dst_vma, dst_addr); pgoff_t pgoff = linear_page_index(dst_vma, dst_addr);
struct folio *folio;
struct page *page; struct page *page;
int ret; int ret;
ret = shmem_getpage(inode, pgoff, &page, SGP_NOALLOC); ret = shmem_get_folio(inode, pgoff, &folio, SGP_NOALLOC);
/* Our caller expects us to return -EFAULT if we failed to find page. */ /* Our caller expects us to return -EFAULT if we failed to find folio */
if (ret == -ENOENT) if (ret == -ENOENT)
ret = -EFAULT; ret = -EFAULT;
if (ret) if (ret)
goto out; goto out;
if (!page) { if (!folio) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
page = folio_file_page(folio, pgoff);
if (PageHWPoison(page)) { if (PageHWPoison(page)) {
ret = -EIO; ret = -EIO;
goto out_release; goto out_release;
...@@ -267,13 +269,13 @@ static int mcontinue_atomic_pte(struct mm_struct *dst_mm, ...@@ -267,13 +269,13 @@ static int mcontinue_atomic_pte(struct mm_struct *dst_mm,
if (ret) if (ret)
goto out_release; goto out_release;
unlock_page(page); folio_unlock(folio);
ret = 0; ret = 0;
out: out:
return ret; return ret;
out_release: out_release:
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
goto out; goto out;
} }
......
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