mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
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:
parent
1252ad136e
commit
ad6c19e5f9
@ -1600,7 +1600,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
|
|||||||
mp, sizeof(struct metapage), 0);
|
mp, sizeof(struct metapage), 0);
|
||||||
print_hex_dump(KERN_ERR, "page: ",
|
print_hex_dump(KERN_ERR, "page: ",
|
||||||
DUMP_PREFIX_ADDRESS, 16,
|
DUMP_PREFIX_ADDRESS, 16,
|
||||||
sizeof(long), mp->page,
|
sizeof(long), mp->folio,
|
||||||
sizeof(struct page), 0);
|
sizeof(struct page), 0);
|
||||||
} else
|
} else
|
||||||
print_hex_dump(KERN_ERR, "tblock:",
|
print_hex_dump(KERN_ERR, "tblock:",
|
||||||
|
@ -47,9 +47,9 @@ static inline void __lock_metapage(struct metapage *mp)
|
|||||||
do {
|
do {
|
||||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
set_current_state(TASK_UNINTERRUPTIBLE);
|
||||||
if (metapage_locked(mp)) {
|
if (metapage_locked(mp)) {
|
||||||
unlock_page(mp->page);
|
folio_unlock(mp->folio);
|
||||||
io_schedule();
|
io_schedule();
|
||||||
lock_page(mp->page);
|
folio_lock(mp->folio);
|
||||||
}
|
}
|
||||||
} while (trylock_metapage(mp));
|
} while (trylock_metapage(mp));
|
||||||
__set_current_state(TASK_RUNNING);
|
__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)
|
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);
|
mp = alloc_metapage(GFP_NOFS);
|
||||||
if (!mp)
|
if (!mp)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
mp->page = &folio->page;
|
mp->folio = folio;
|
||||||
mp->sb = inode->i_sb;
|
mp->sb = inode->i_sb;
|
||||||
mp->flag = 0;
|
mp->flag = 0;
|
||||||
mp->xflag = COMMIT_PAGE;
|
mp->xflag = COMMIT_PAGE;
|
||||||
@ -682,11 +682,11 @@ unlock:
|
|||||||
void grab_metapage(struct metapage * mp)
|
void grab_metapage(struct metapage * mp)
|
||||||
{
|
{
|
||||||
jfs_info("grab_metapage: mp = 0x%p", mp);
|
jfs_info("grab_metapage: mp = 0x%p", mp);
|
||||||
get_page(mp->page);
|
folio_get(mp->folio);
|
||||||
lock_page(mp->page);
|
folio_lock(mp->folio);
|
||||||
mp->count++;
|
mp->count++;
|
||||||
lock_metapage(mp);
|
lock_metapage(mp);
|
||||||
unlock_page(mp->page);
|
folio_unlock(mp->folio);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metapage_write_one(struct folio *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)
|
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);
|
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);
|
||||||
@ -734,26 +734,26 @@ void force_metapage(struct metapage *mp)
|
|||||||
|
|
||||||
void hold_metapage(struct metapage *mp)
|
void hold_metapage(struct metapage *mp)
|
||||||
{
|
{
|
||||||
lock_page(mp->page);
|
folio_lock(mp->folio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_metapage(struct metapage *mp)
|
void put_metapage(struct metapage *mp)
|
||||||
{
|
{
|
||||||
if (mp->count || mp->nohomeok) {
|
if (mp->count || mp->nohomeok) {
|
||||||
/* Someone else will release this */
|
/* Someone else will release this */
|
||||||
unlock_page(mp->page);
|
folio_unlock(mp->folio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
get_page(mp->page);
|
folio_get(mp->folio);
|
||||||
mp->count++;
|
mp->count++;
|
||||||
lock_metapage(mp);
|
lock_metapage(mp);
|
||||||
unlock_page(mp->page);
|
folio_unlock(mp->folio);
|
||||||
release_metapage(mp);
|
release_metapage(mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void release_metapage(struct 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);
|
jfs_info("release_metapage: mp = 0x%p, flag = 0x%lx", mp, mp->flag);
|
||||||
|
|
||||||
folio_lock(folio);
|
folio_lock(folio);
|
||||||
|
@ -24,7 +24,7 @@ struct metapage {
|
|||||||
wait_queue_head_t wait;
|
wait_queue_head_t wait;
|
||||||
|
|
||||||
/* implementation */
|
/* implementation */
|
||||||
struct page *page;
|
struct folio *folio;
|
||||||
struct super_block *sb;
|
struct super_block *sb;
|
||||||
unsigned int logical_size;
|
unsigned int logical_size;
|
||||||
|
|
||||||
@ -90,14 +90,14 @@ static inline void discard_metapage(struct metapage *mp)
|
|||||||
|
|
||||||
static inline void metapage_nohomeok(struct metapage *mp)
|
static inline void metapage_nohomeok(struct metapage *mp)
|
||||||
{
|
{
|
||||||
struct page *page = mp->page;
|
struct folio *folio = mp->folio;
|
||||||
lock_page(page);
|
folio_lock(folio);
|
||||||
if (!mp->nohomeok++) {
|
if (!mp->nohomeok++) {
|
||||||
mark_metapage_dirty(mp);
|
mark_metapage_dirty(mp);
|
||||||
get_page(page);
|
folio_get(folio);
|
||||||
wait_on_page_writeback(page);
|
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)
|
static inline void metapage_wait_for_io(struct metapage *mp)
|
||||||
{
|
{
|
||||||
if (test_bit(META_io, &mp->flag))
|
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)
|
static inline void _metapage_homeok(struct metapage *mp)
|
||||||
{
|
{
|
||||||
if (!--mp->nohomeok)
|
if (!--mp->nohomeok)
|
||||||
put_page(mp->page);
|
folio_put(mp->folio);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void metapage_homeok(struct metapage *mp)
|
static inline void metapage_homeok(struct metapage *mp)
|
||||||
|
Loading…
Reference in New Issue
Block a user