mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
f2fs: Pass a folio to make_empty_dir()
Pass the folio into make_empty_dir() and then into f2fs_get_new_data_folio(). Removes a call 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>
This commit is contained in:
parent
7c99299c9a
commit
bdbf142204
|
|
@ -1338,11 +1338,11 @@ struct folio *f2fs_get_lock_data_folio(struct inode *inode, pgoff_t index,
|
|||
*
|
||||
* Also, caller should grab and release a rwsem by calling f2fs_lock_op() and
|
||||
* f2fs_unlock_op().
|
||||
* Note that, ipage is set only by make_empty_dir, and if any error occur,
|
||||
* ipage should be released by this function.
|
||||
* Note that, ifolio is set only by make_empty_dir, and if any error occur,
|
||||
* ifolio should be released by this function.
|
||||
*/
|
||||
struct folio *f2fs_get_new_data_folio(struct inode *inode,
|
||||
struct page *ipage, pgoff_t index, bool new_i_size)
|
||||
struct folio *ifolio, pgoff_t index, bool new_i_size)
|
||||
{
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
struct folio *folio;
|
||||
|
|
@ -1352,20 +1352,20 @@ struct folio *f2fs_get_new_data_folio(struct inode *inode,
|
|||
folio = f2fs_grab_cache_folio(mapping, index, true);
|
||||
if (IS_ERR(folio)) {
|
||||
/*
|
||||
* before exiting, we should make sure ipage will be released
|
||||
* before exiting, we should make sure ifolio will be released
|
||||
* if any error occur.
|
||||
*/
|
||||
f2fs_put_page(ipage, 1);
|
||||
f2fs_folio_put(ifolio, true);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
set_new_dnode(&dn, inode, ipage, NULL, 0);
|
||||
set_new_dnode(&dn, inode, &ifolio->page, NULL, 0);
|
||||
err = f2fs_reserve_block(&dn, index);
|
||||
if (err) {
|
||||
f2fs_folio_put(folio, true);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
if (!ipage)
|
||||
if (!ifolio)
|
||||
f2fs_put_dnode(&dn);
|
||||
|
||||
if (folio_test_uptodate(folio))
|
||||
|
|
@ -1378,8 +1378,8 @@ struct folio *f2fs_get_new_data_folio(struct inode *inode,
|
|||
} else {
|
||||
f2fs_folio_put(folio, true);
|
||||
|
||||
/* if ipage exists, blkaddr should be NEW_ADDR */
|
||||
f2fs_bug_on(F2FS_I_SB(inode), ipage);
|
||||
/* if ifolio exists, blkaddr should be NEW_ADDR */
|
||||
f2fs_bug_on(F2FS_I_SB(inode), ifolio);
|
||||
folio = f2fs_get_lock_data_folio(inode, index, true);
|
||||
if (IS_ERR(folio))
|
||||
return folio;
|
||||
|
|
|
|||
|
|
@ -492,16 +492,16 @@ void f2fs_do_make_empty_dir(struct inode *inode, struct inode *parent,
|
|||
}
|
||||
|
||||
static int make_empty_dir(struct inode *inode,
|
||||
struct inode *parent, struct page *page)
|
||||
struct inode *parent, struct folio *folio)
|
||||
{
|
||||
struct folio *dentry_folio;
|
||||
struct f2fs_dentry_block *dentry_blk;
|
||||
struct f2fs_dentry_ptr d;
|
||||
|
||||
if (f2fs_has_inline_dentry(inode))
|
||||
return f2fs_make_empty_inline_dir(inode, parent, page);
|
||||
return f2fs_make_empty_inline_dir(inode, parent, &folio->page);
|
||||
|
||||
dentry_folio = f2fs_get_new_data_folio(inode, page, 0, true);
|
||||
dentry_folio = f2fs_get_new_data_folio(inode, folio, 0, true);
|
||||
if (IS_ERR(dentry_folio))
|
||||
return PTR_ERR(dentry_folio);
|
||||
|
||||
|
|
@ -529,7 +529,7 @@ struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir,
|
|||
if (S_ISDIR(inode->i_mode)) {
|
||||
/* in order to handle error case */
|
||||
folio_get(folio);
|
||||
err = make_empty_dir(inode, dir, &folio->page);
|
||||
err = make_empty_dir(inode, dir, folio);
|
||||
if (err) {
|
||||
folio_lock(folio);
|
||||
goto put_error;
|
||||
|
|
|
|||
|
|
@ -3969,7 +3969,7 @@ struct folio *f2fs_find_data_folio(struct inode *inode, pgoff_t index,
|
|||
struct folio *f2fs_get_lock_data_folio(struct inode *inode, pgoff_t index,
|
||||
bool for_write);
|
||||
struct folio *f2fs_get_new_data_folio(struct inode *inode,
|
||||
struct page *ipage, pgoff_t index, bool new_i_size);
|
||||
struct folio *ifolio, pgoff_t index, bool new_i_size);
|
||||
int f2fs_do_write_data_page(struct f2fs_io_info *fio);
|
||||
int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag);
|
||||
int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user