Skip to content

Commit 3d47e31

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
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/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Naoya Horiguchi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 2e16898 commit 3d47e31

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mm/memory-failure.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,17 +1014,18 @@ static int me_unknown(struct page_state *ps, struct page *p)
10141014
*/
10151015
static int me_pagecache_clean(struct page_state *ps, struct page *p)
10161016
{
1017+
struct folio *folio = page_folio(p);
10171018
int ret;
10181019
struct address_space *mapping;
10191020
bool extra_pins;
10201021

10211022
delete_from_lru_cache(p);
10221023

10231024
/*
1024-
* For anonymous pages we're done the only reference left
1025+
* For anonymous folios the only reference left
10251026
* should be the one m_f() holds.
10261027
*/
1027-
if (PageAnon(p)) {
1028+
if (folio_test_anon(folio)) {
10281029
ret = MF_RECOVERED;
10291030
goto out;
10301031
}
@@ -1036,11 +1037,9 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
10361037
* has a reference, because it could be file system metadata
10371038
* and that's not safe to truncate.
10381039
*/
1039-
mapping = page_mapping(p);
1040+
mapping = folio_mapping(folio);
10401041
if (!mapping) {
1041-
/*
1042-
* Page has been teared down in the meanwhile
1043-
*/
1042+
/* Folio has been torn down in the meantime */
10441043
ret = MF_FAILED;
10451044
goto out;
10461045
}
@@ -1061,7 +1060,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
10611060
ret = MF_FAILED;
10621061

10631062
out:
1064-
unlock_page(p);
1063+
folio_unlock(folio);
10651064

10661065
return ret;
10671066
}

0 commit comments

Comments
 (0)