jfs: Change metapage->page to metapage->folio

Convert all the users to operate on a folio.  Saves sixteen calls to
compound_head().  We still use sizeof(struct page) in print_hex_dump,
otherwise it will go into the second and third pages of the folio which
won't exist for jfs folios (since they are not large).  This needs a
better solution, but finding it can be postponed.

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:56 +01:00 committed by Dave Kleikamp
parent 1252ad136e
commit ad6c19e5f9
3 changed files with 22 additions and 22 deletions

View File

@ -1600,7 +1600,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
mp, sizeof(struct metapage), 0);
print_hex_dump(KERN_ERR, "page: ",
DUMP_PREFIX_ADDRESS, 16,
sizeof(long), mp->page,
sizeof(long), mp->folio,
sizeof(struct page), 0);
} else
print_hex_dump(KERN_ERR, "tblock:",

View File

@ -47,9 +47,9 @@ static inline void __lock_metapage(struct metapage *mp)
do {
set_current_state(TASK_UNINTERRUPTIBLE);
if (metapage_locked(mp)) {
unlock_page(mp->page);
folio_unlock(mp->folio);
io_schedule();
lock_page(mp->page);
folio_lock(mp->folio);
}
} while (trylock_metapage(mp));
__set_current_state(TASK_RUNNING);
@ -57,7 +57,7 @@ static inline void __lock_metapage(struct metapage *mp)
}
/*
* Must have mp->page locked
* Must have mp->folio locked
*/
static inline void lock_metapage(struct metapage *mp)
{
@ -649,7 +649,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
mp = alloc_metapage(GFP_NOFS);
if (!mp)
goto unlock;
mp->page = &folio->page;
mp->folio = folio;
mp->sb = inode->i_sb;
mp->flag = 0;
mp->xflag = COMMIT_PAGE;
@ -682,11 +682,11 @@ unlock:
void grab_metapage(struct metapage * mp)
{
jfs_info("grab_metapage: mp = 0x%p", mp);
get_page(mp->page);
lock_page(mp->page);
folio_get(mp->folio);
folio_lock(mp->folio);
mp->count++;
lock_metapage(mp);
unlock_page(mp->page);
folio_unlock(mp->folio);
}
static int metapage_write_one(struct folio *folio)
@ -719,7 +719,7 @@ static int metapage_write_one(struct folio *folio)
void force_metapage(struct metapage *mp)
{
struct folio *folio = page_folio(mp->page);
struct folio *folio = mp->folio;
jfs_info("force_metapage: mp = 0x%p", mp);
set_bit(META_forcewrite, &mp->flag);
clear_bit(META_sync, &mp->flag);
@ -734,26 +734,26 @@ void force_metapage(struct metapage *mp)
void hold_metapage(struct metapage *mp)
{
lock_page(mp->page);
folio_lock(mp->folio);
}
void put_metapage(struct metapage *mp)
{
if (mp->count || mp->nohomeok) {
/* Someone else will release this */
unlock_page(mp->page);
folio_unlock(mp->folio);
return;
}
get_page(mp->page);
folio_get(mp->folio);
mp->count++;
lock_metapage(mp);
unlock_page(mp->page);
folio_unlock(mp->folio);
release_metapage(mp);
}
void release_metapage(struct metapage * mp)
{
struct folio *folio = page_folio(mp->page);
struct folio *folio = mp->folio;
jfs_info("release_metapage: mp = 0x%p, flag = 0x%lx", mp, mp->flag);
folio_lock(folio);

View File

@ -24,7 +24,7 @@ struct metapage {
wait_queue_head_t wait;
/* implementation */
struct page *page;
struct folio *folio;
struct super_block *sb;
unsigned int logical_size;
@ -90,14 +90,14 @@ static inline void discard_metapage(struct metapage *mp)
static inline void metapage_nohomeok(struct metapage *mp)
{
struct page *page = mp->page;
lock_page(page);
struct folio *folio = mp->folio;
folio_lock(folio);
if (!mp->nohomeok++) {
mark_metapage_dirty(mp);
get_page(page);
wait_on_page_writeback(page);
folio_get(folio);
folio_wait_writeback(folio);
}
unlock_page(page);
folio_unlock(folio);
}
/*
@ -107,7 +107,7 @@ static inline void metapage_nohomeok(struct metapage *mp)
static inline void metapage_wait_for_io(struct metapage *mp)
{
if (test_bit(META_io, &mp->flag))
wait_on_page_writeback(mp->page);
folio_wait_writeback(mp->folio);
}
/*
@ -116,7 +116,7 @@ static inline void metapage_wait_for_io(struct metapage *mp)
static inline void _metapage_homeok(struct metapage *mp)
{
if (!--mp->nohomeok)
put_page(mp->page);
folio_put(mp->folio);
}
static inline void metapage_homeok(struct metapage *mp)