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

memory-failure: use a folio in me_pagecache_clean()

Patch series "Convert aops->error_remove_page to ->error_remove_folio".

This is a memory-failure patch series which converts a lot of uses of page
APIs into folio APIs with the usual benefits.  


This patch (of 6):

Replaces three hidden calls to compound_head() with one visible one.
Fix up a few comments while I'm modifying this function.

Link: https://lkml.kernel.org/r/20231117161447.2461643-1-willy@infradead.org
Link: https://lkml.kernel.org/r/20231117161447.2461643-2-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 2e16898d
...@@ -1014,6 +1014,7 @@ static int me_unknown(struct page_state *ps, struct page *p) ...@@ -1014,6 +1014,7 @@ static int me_unknown(struct page_state *ps, struct page *p)
*/ */
static int me_pagecache_clean(struct page_state *ps, struct page *p) static int me_pagecache_clean(struct page_state *ps, struct page *p)
{ {
struct folio *folio = page_folio(p);
int ret; int ret;
struct address_space *mapping; struct address_space *mapping;
bool extra_pins; bool extra_pins;
...@@ -1021,10 +1022,10 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) ...@@ -1021,10 +1022,10 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
delete_from_lru_cache(p); delete_from_lru_cache(p);
/* /*
* For anonymous pages we're done the only reference left * For anonymous folios the only reference left
* should be the one m_f() holds. * should be the one m_f() holds.
*/ */
if (PageAnon(p)) { if (folio_test_anon(folio)) {
ret = MF_RECOVERED; ret = MF_RECOVERED;
goto out; goto out;
} }
...@@ -1036,11 +1037,9 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) ...@@ -1036,11 +1037,9 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
* has a reference, because it could be file system metadata * has a reference, because it could be file system metadata
* and that's not safe to truncate. * and that's not safe to truncate.
*/ */
mapping = page_mapping(p); mapping = folio_mapping(folio);
if (!mapping) { if (!mapping) {
/* /* Folio has been torn down in the meantime */
* Page has been teared down in the meanwhile
*/
ret = MF_FAILED; ret = MF_FAILED;
goto out; goto out;
} }
...@@ -1061,7 +1060,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) ...@@ -1061,7 +1060,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
ret = MF_FAILED; ret = MF_FAILED;
out: out:
unlock_page(p); folio_unlock(folio);
return ret; return ret;
} }
......
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