mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
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.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Naoya Horiguchi <naoya.horiguchi@nec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
2e16898d0d
commit
3d47e31790
@ -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)
|
||||
{
|
||||
struct folio *folio = page_folio(p);
|
||||
int ret;
|
||||
struct address_space *mapping;
|
||||
bool extra_pins;
|
||||
@ -1021,10 +1022,10 @@ static int me_pagecache_clean(struct page_state *ps, struct page *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.
|
||||
*/
|
||||
if (PageAnon(p)) {
|
||||
if (folio_test_anon(folio)) {
|
||||
ret = MF_RECOVERED;
|
||||
goto out;
|
||||
}
|
||||
@ -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
|
||||
* and that's not safe to truncate.
|
||||
*/
|
||||
mapping = page_mapping(p);
|
||||
mapping = folio_mapping(folio);
|
||||
if (!mapping) {
|
||||
/*
|
||||
* Page has been teared down in the meanwhile
|
||||
*/
|
||||
/* Folio has been torn down in the meantime */
|
||||
ret = MF_FAILED;
|
||||
goto out;
|
||||
}
|
||||
@ -1061,7 +1060,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
|
||||
ret = MF_FAILED;
|
||||
|
||||
out:
|
||||
unlock_page(p);
|
||||
folio_unlock(folio);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user