mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 10:27:37 +00:00
f2fs: Add f2fs_find_data_folio()
Convert f2fs_find_data_page() to f2fs_find_data_folio() and add a compatibility wrapper. Saves six hidden calls to compound_head(). This was the last caller of f2fs_get_read_data_page(), so remove the compatibility wrapper. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
a86e109ee2
commit
0cd402baa0
@ -1279,30 +1279,33 @@ put_err:
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
struct page *f2fs_find_data_page(struct inode *inode, pgoff_t index,
|
||||
struct folio *f2fs_find_data_folio(struct inode *inode, pgoff_t index,
|
||||
pgoff_t *next_pgofs)
|
||||
{
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
|
||||
page = find_get_page_flags(mapping, index, FGP_ACCESSED);
|
||||
if (page && PageUptodate(page))
|
||||
return page;
|
||||
f2fs_put_page(page, 0);
|
||||
folio = __filemap_get_folio(mapping, index, FGP_ACCESSED, 0);
|
||||
if (IS_ERR(folio))
|
||||
goto read;
|
||||
if (folio_test_uptodate(folio))
|
||||
return folio;
|
||||
f2fs_folio_put(folio, false);
|
||||
|
||||
page = f2fs_get_read_data_page(inode, index, 0, false, next_pgofs);
|
||||
if (IS_ERR(page))
|
||||
return page;
|
||||
read:
|
||||
folio = f2fs_get_read_data_folio(inode, index, 0, false, next_pgofs);
|
||||
if (IS_ERR(folio))
|
||||
return folio;
|
||||
|
||||
if (PageUptodate(page))
|
||||
return page;
|
||||
if (folio_test_uptodate(folio))
|
||||
return folio;
|
||||
|
||||
wait_on_page_locked(page);
|
||||
if (unlikely(!PageUptodate(page))) {
|
||||
f2fs_put_page(page, 0);
|
||||
folio_wait_locked(folio);
|
||||
if (unlikely(!folio_test_uptodate(folio))) {
|
||||
f2fs_folio_put(folio, false);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
return page;
|
||||
return folio;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3908,8 +3908,8 @@ int f2fs_get_block_locked(struct dnode_of_data *dn, pgoff_t index);
|
||||
int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index);
|
||||
struct folio *f2fs_get_read_data_folio(struct inode *inode, pgoff_t index,
|
||||
blk_opf_t op_flags, bool for_write, pgoff_t *next_pgofs);
|
||||
struct page *f2fs_find_data_page(struct inode *inode, pgoff_t index,
|
||||
pgoff_t *next_pgofs);
|
||||
struct folio *f2fs_find_data_folio(struct inode *inode, pgoff_t index,
|
||||
pgoff_t *next_pgofs);
|
||||
struct folio *f2fs_get_lock_data_folio(struct inode *inode, pgoff_t index,
|
||||
bool for_write);
|
||||
struct page *f2fs_get_new_data_page(struct inode *inode,
|
||||
@ -3937,12 +3937,10 @@ int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi);
|
||||
void f2fs_destroy_post_read_wq(struct f2fs_sb_info *sbi);
|
||||
extern const struct iomap_ops f2fs_iomap_ops;
|
||||
|
||||
static inline struct page *f2fs_get_read_data_page(struct inode *inode,
|
||||
pgoff_t index, blk_opf_t op_flags, bool for_write,
|
||||
pgoff_t *next_pgofs)
|
||||
static inline struct page *f2fs_find_data_page(struct inode *inode,
|
||||
pgoff_t index, pgoff_t *next_pgofs)
|
||||
{
|
||||
struct folio *folio = f2fs_get_read_data_folio(inode, index, op_flags,
|
||||
for_write, next_pgofs);
|
||||
struct folio *folio = f2fs_find_data_folio(inode, index, next_pgofs);
|
||||
|
||||
return &folio->page;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user