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

shmem: convert shmem_read_mapping_page_gfp() to use shmem_get_folio_gfp()

Saves a couple of calls to compound_head().

Link: https://lkml.kernel.org/r/20220902194653.1739778-24-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 68a54100
...@@ -4270,18 +4270,20 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, ...@@ -4270,18 +4270,20 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
{ {
#ifdef CONFIG_SHMEM #ifdef CONFIG_SHMEM
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct folio *folio;
struct page *page; struct page *page;
int error; int error;
BUG_ON(!shmem_mapping(mapping)); BUG_ON(!shmem_mapping(mapping));
error = shmem_getpage_gfp(inode, index, &page, SGP_CACHE, error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE,
gfp, NULL, NULL, NULL); gfp, NULL, NULL, NULL);
if (error) if (error)
return ERR_PTR(error); return ERR_PTR(error);
unlock_page(page); folio_unlock(folio);
page = folio_file_page(folio, index);
if (PageHWPoison(page)) { if (PageHWPoison(page)) {
put_page(page); folio_put(folio);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
......
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