jfs: Convert drop_metapage and remove_metapage to take a folio

All callers now have a folio, so pass it in instead of the page.
Removes a couple of calls to compound_head().

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:50 +01:00 committed by Dave Kleikamp
parent 40e1bd195b
commit dd23bf3103

View File

@ -112,10 +112,10 @@ static inline int insert_metapage(struct folio *folio, struct metapage *mp)
return 0;
}
static inline void remove_metapage(struct page *page, struct metapage *mp)
static inline void remove_metapage(struct folio *folio, struct metapage *mp)
{
struct meta_anchor *a = mp_anchor(page);
int l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits;
struct meta_anchor *a = folio->private;
int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits;
int index;
index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
@ -125,8 +125,8 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)
a->mp[index] = NULL;
if (--a->mp_count == 0) {
kfree(a);
detach_page_private(page);
kunmap(page);
folio_detach_private(folio);
kunmap(&folio->page);
}
}
@ -156,10 +156,10 @@ static inline int insert_metapage(struct folio *folio, struct metapage *mp)
return 0;
}
static inline void remove_metapage(struct page *page, struct metapage *mp)
static inline void remove_metapage(struct folio *folio, struct metapage *mp)
{
detach_page_private(page);
kunmap(page);
folio_detach_private(folio);
kunmap(&folio->page);
}
#define inc_io(page) do {} while(0)
@ -214,12 +214,12 @@ void metapage_exit(void)
kmem_cache_destroy(metapage_cache);
}
static inline void drop_metapage(struct page *page, struct metapage *mp)
static inline void drop_metapage(struct folio *folio, struct metapage *mp)
{
if (mp->count || mp->nohomeok || test_bit(META_dirty, &mp->flag) ||
test_bit(META_io, &mp->flag))
return;
remove_metapage(page, mp);
remove_metapage(folio, mp);
INCREMENT(mpStat.pagefree);
free_metapage(mp);
}
@ -539,7 +539,7 @@ static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask)
}
if (mp->lsn)
remove_from_logsync(mp);
remove_metapage(&folio->page, mp);
remove_metapage(folio, mp);
INCREMENT(mpStat.pagefree);
free_metapage(mp);
}
@ -774,7 +774,7 @@ void release_metapage(struct metapage * mp)
remove_from_logsync(mp);
/* Try to keep metapages from using up too much memory */
drop_metapage(&folio->page, mp);
drop_metapage(folio, mp);
folio_unlock(folio);
folio_put(folio);