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

memory-failure: convert truncate_error_page to truncate_error_folio

Both callers now have a folio, so pass it in.  Nothing downstream was
expecting a tail page; that's asserted in generic_error_remove_page(), for
example.

Link: https://lkml.kernel.org/r/20231117161447.2461643-6-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent b6fd410c
...@@ -927,14 +927,13 @@ static int delete_from_lru_cache(struct folio *folio) ...@@ -927,14 +927,13 @@ static int delete_from_lru_cache(struct folio *folio)
return -EIO; return -EIO;
} }
static int truncate_error_page(struct page *p, unsigned long pfn, static int truncate_error_page(struct folio *folio, unsigned long pfn,
struct address_space *mapping) struct address_space *mapping)
{ {
struct folio *folio = page_folio(p);
int ret = MF_FAILED; int ret = MF_FAILED;
if (mapping->a_ops->error_remove_page) { if (mapping->a_ops->error_remove_page) {
int err = mapping->a_ops->error_remove_page(mapping, p); int err = mapping->a_ops->error_remove_page(mapping, &folio->page);
if (err != 0) if (err != 0)
pr_info("%#lx: Failed to punch page: %d\n", pfn, err); pr_info("%#lx: Failed to punch page: %d\n", pfn, err);
...@@ -1055,7 +1054,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) ...@@ -1055,7 +1054,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
* *
* Open: to take i_rwsem or not for this? Right now we don't. * Open: to take i_rwsem or not for this? Right now we don't.
*/ */
ret = truncate_error_page(p, page_to_pfn(p), mapping); ret = truncate_error_page(folio, page_to_pfn(p), mapping);
if (has_extra_refcount(ps, p, extra_pins)) if (has_extra_refcount(ps, p, extra_pins))
ret = MF_FAILED; ret = MF_FAILED;
...@@ -1189,7 +1188,7 @@ static int me_huge_page(struct page_state *ps, struct page *p) ...@@ -1189,7 +1188,7 @@ static int me_huge_page(struct page_state *ps, struct page *p)
mapping = folio_mapping(folio); mapping = folio_mapping(folio);
if (mapping) { if (mapping) {
res = truncate_error_page(&folio->page, page_to_pfn(p), mapping); res = truncate_error_page(folio, page_to_pfn(p), mapping);
/* The page is kept in page cache. */ /* The page is kept in page cache. */
extra_pins = true; extra_pins = true;
folio_unlock(folio); folio_unlock(folio);
......
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