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