mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
jfs: Convert __get_metapage to use a folio
Remove four hidden 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:
parent
35474d52c6
commit
2dcd9630d9
@ -577,7 +577,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
|
||||
int l2bsize;
|
||||
struct address_space *mapping;
|
||||
struct metapage *mp = NULL;
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
unsigned long page_index;
|
||||
unsigned long page_offset;
|
||||
|
||||
@ -608,22 +608,22 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
|
||||
}
|
||||
|
||||
if (new && (PSIZE == PAGE_SIZE)) {
|
||||
page = grab_cache_page(mapping, page_index);
|
||||
if (!page) {
|
||||
jfs_err("grab_cache_page failed!");
|
||||
folio = filemap_grab_folio(mapping, page_index);
|
||||
if (IS_ERR(folio)) {
|
||||
jfs_err("filemap_grab_folio failed!");
|
||||
return NULL;
|
||||
}
|
||||
SetPageUptodate(page);
|
||||
folio_mark_uptodate(folio);
|
||||
} else {
|
||||
page = read_mapping_page(mapping, page_index, NULL);
|
||||
if (IS_ERR(page)) {
|
||||
folio = read_mapping_folio(mapping, page_index, NULL);
|
||||
if (IS_ERR(folio)) {
|
||||
jfs_err("read_mapping_page failed!");
|
||||
return NULL;
|
||||
}
|
||||
lock_page(page);
|
||||
folio_lock(folio);
|
||||
}
|
||||
|
||||
mp = page_to_mp(page, page_offset);
|
||||
mp = page_to_mp(&folio->page, page_offset);
|
||||
if (mp) {
|
||||
if (mp->logical_size != size) {
|
||||
jfs_error(inode->i_sb,
|
||||
@ -649,16 +649,16 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
|
||||
mp = alloc_metapage(GFP_NOFS);
|
||||
if (!mp)
|
||||
goto unlock;
|
||||
mp->page = page;
|
||||
mp->page = &folio->page;
|
||||
mp->sb = inode->i_sb;
|
||||
mp->flag = 0;
|
||||
mp->xflag = COMMIT_PAGE;
|
||||
mp->count = 1;
|
||||
mp->nohomeok = 0;
|
||||
mp->logical_size = size;
|
||||
mp->data = page_address(page) + page_offset;
|
||||
mp->data = folio_address(folio) + page_offset;
|
||||
mp->index = lblock;
|
||||
if (unlikely(insert_metapage(page, mp))) {
|
||||
if (unlikely(insert_metapage(&folio->page, mp))) {
|
||||
free_metapage(mp);
|
||||
goto unlock;
|
||||
}
|
||||
@ -670,12 +670,12 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
|
||||
memset(mp->data, 0, PSIZE);
|
||||
}
|
||||
|
||||
unlock_page(page);
|
||||
folio_unlock(folio);
|
||||
jfs_info("__get_metapage: returning = 0x%p data = 0x%p", mp, mp->data);
|
||||
return mp;
|
||||
|
||||
unlock:
|
||||
unlock_page(page);
|
||||
folio_unlock(folio);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user