f2fs: Add f2fs_get_lock_data_folio()
Convert f2fs_get_lock_data_page() to f2fs_get_lock_data_folio() and add a compatibility wrapper. Removes three hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>pull/1188/head
parent
4ae71b1996
commit
20f974cd21
|
|
@ -1310,23 +1310,23 @@ struct page *f2fs_find_data_page(struct inode *inode, pgoff_t index,
|
|||
* Because, the callers, functions in dir.c and GC, should be able to know
|
||||
* whether this page exists or not.
|
||||
*/
|
||||
struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
|
||||
struct folio *f2fs_get_lock_data_folio(struct inode *inode, pgoff_t index,
|
||||
bool for_write)
|
||||
{
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
|
||||
page = f2fs_get_read_data_page(inode, index, 0, for_write, NULL);
|
||||
if (IS_ERR(page))
|
||||
return page;
|
||||
folio = f2fs_get_read_data_folio(inode, index, 0, for_write, NULL);
|
||||
if (IS_ERR(folio))
|
||||
return folio;
|
||||
|
||||
/* wait for read completion */
|
||||
lock_page(page);
|
||||
if (unlikely(page->mapping != mapping || !PageUptodate(page))) {
|
||||
f2fs_put_page(page, 1);
|
||||
folio_lock(folio);
|
||||
if (unlikely(folio->mapping != mapping || !folio_test_uptodate(folio))) {
|
||||
f2fs_folio_put(folio, true);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
return page;
|
||||
return folio;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3910,7 +3910,7 @@ 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 page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
|
||||
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,
|
||||
struct page *ipage, pgoff_t index, bool new_i_size);
|
||||
|
|
@ -3947,6 +3947,14 @@ static inline struct page *f2fs_get_read_data_page(struct inode *inode,
|
|||
return &folio->page;
|
||||
}
|
||||
|
||||
static inline struct page *f2fs_get_lock_data_page(struct inode *inode,
|
||||
pgoff_t index, bool for_write)
|
||||
{
|
||||
struct folio *folio = f2fs_get_lock_data_folio(inode, index, for_write);
|
||||
|
||||
return &folio->page;
|
||||
}
|
||||
|
||||
/*
|
||||
* gc.c
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue