jfs: Convert force_metapage to use a folio

Convert the mp->page to a folio and operate on it.  That lets us
convert metapage_write_one() to take a folio.  Replaces five calls to
compound_head() with one.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-04-17 18:56:55 +01:00 committed by Dave Kleikamp
parent d9c36002d0
commit 1252ad136e

View File

@ -689,9 +689,8 @@ void grab_metapage(struct metapage * mp)
unlock_page(mp->page);
}
static int metapage_write_one(struct page *page)
static int metapage_write_one(struct folio *folio)
{
struct folio *folio = page_folio(page);
struct address_space *mapping = folio->mapping;
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
@ -720,17 +719,17 @@ static int metapage_write_one(struct page *page)
void force_metapage(struct metapage *mp)
{
struct page *page = mp->page;
struct folio *folio = page_folio(mp->page);
jfs_info("force_metapage: mp = 0x%p", mp);
set_bit(META_forcewrite, &mp->flag);
clear_bit(META_sync, &mp->flag);
get_page(page);
lock_page(page);
set_page_dirty(page);
if (metapage_write_one(page))
folio_get(folio);
folio_lock(folio);
folio_mark_dirty(folio);
if (metapage_write_one(folio))
jfs_error(mp->sb, "metapage_write_one() failed\n");
clear_bit(META_forcewrite, &mp->flag);
put_page(page);
folio_put(folio);
}
void hold_metapage(struct metapage *mp)
@ -771,7 +770,7 @@ void release_metapage(struct metapage * mp)
folio_mark_dirty(folio);
if (test_bit(META_sync, &mp->flag)) {
clear_bit(META_sync, &mp->flag);
if (metapage_write_one(&folio->page))
if (metapage_write_one(folio))
jfs_error(mp->sb, "metapage_write_one() failed\n");
folio_lock(folio);
}