mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-19 07:39:54 +02:00
UPSTREAM: f2fs: convert f2fs_write_single_data_page() to use folio
Convert to use folio, so that we can get rid of 'page->index' to
prepare for removal of 'index' field in structure page [1].
[1] https://lore.kernel.org/all/Zp8fgUSIBGQ1TN0D@casper.infradead.org/
Cc: Matthew Wilcox <willy@infradead.org>
Change-Id: I4c112d34f1124186e37677f0ea587fd8a31400f3
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 46a75ef866
)
This commit is contained in:
parent
8000d9726a
commit
76c1121bee
|
@ -1543,7 +1543,8 @@ continue_unlock:
|
|||
if (!clear_page_dirty_for_io(cc->rpages[i]))
|
||||
goto continue_unlock;
|
||||
|
||||
ret = f2fs_write_single_data_page(cc->rpages[i], &submitted,
|
||||
ret = f2fs_write_single_data_page(page_folio(cc->rpages[i]),
|
||||
&submitted,
|
||||
NULL, NULL, wbc, io_type,
|
||||
compr_blocks, false);
|
||||
if (ret) {
|
||||
|
|
|
@ -2786,7 +2786,7 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
int f2fs_write_single_data_page(struct page *page, int *submitted,
|
||||
int f2fs_write_single_data_page(struct folio *folio, int *submitted,
|
||||
struct bio **bio,
|
||||
sector_t *last_block,
|
||||
struct writeback_control *wbc,
|
||||
|
@ -2794,12 +2794,13 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
|
|||
int compr_blocks,
|
||||
bool allow_balance)
|
||||
{
|
||||
struct inode *inode = page->mapping->host;
|
||||
struct inode *inode = folio->mapping->host;
|
||||
struct page *page = folio_page(folio, 0);
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||
loff_t i_size = i_size_read(inode);
|
||||
const pgoff_t end_index = ((unsigned long long)i_size)
|
||||
>> PAGE_SHIFT;
|
||||
loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT;
|
||||
loff_t psize = (loff_t)(folio->index + 1) << PAGE_SHIFT;
|
||||
unsigned offset = 0;
|
||||
bool need_balance_fs = false;
|
||||
bool quota_inode = IS_NOQUOTA(inode);
|
||||
|
@ -2823,11 +2824,11 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
|
|||
.last_block = last_block,
|
||||
};
|
||||
|
||||
trace_f2fs_writepage(page_folio(page), DATA);
|
||||
trace_f2fs_writepage(folio, DATA);
|
||||
|
||||
/* we should bypass data pages to proceed the kworker jobs */
|
||||
if (unlikely(f2fs_cp_error(sbi))) {
|
||||
mapping_set_error(page->mapping, -EIO);
|
||||
mapping_set_error(folio->mapping, -EIO);
|
||||
/*
|
||||
* don't drop any dirty dentry pages for keeping lastest
|
||||
* directory structure.
|
||||
|
@ -2845,7 +2846,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
|
|||
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
||||
goto redirty_out;
|
||||
|
||||
if (page->index < end_index ||
|
||||
if (folio->index < end_index ||
|
||||
f2fs_verity_in_progress(inode) ||
|
||||
compr_blocks)
|
||||
goto write;
|
||||
|
@ -2855,10 +2856,10 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
|
|||
* this page does not have to be written to disk.
|
||||
*/
|
||||
offset = i_size & (PAGE_SIZE - 1);
|
||||
if ((page->index >= end_index + 1) || !offset)
|
||||
if ((folio->index >= end_index + 1) || !offset)
|
||||
goto out;
|
||||
|
||||
zero_user_segment(page, offset, PAGE_SIZE);
|
||||
folio_zero_segment(folio, offset, folio_size(folio));
|
||||
write:
|
||||
/* Dentry/quota blocks are controlled by checkpoint */
|
||||
if (S_ISDIR(inode->i_mode) || quota_inode) {
|
||||
|
@ -2918,7 +2919,7 @@ done:
|
|||
out:
|
||||
inode_dec_dirty_pages(inode);
|
||||
if (err) {
|
||||
ClearPageUptodate(page);
|
||||
folio_clear_uptodate(folio);
|
||||
clear_page_private_gcing(page);
|
||||
}
|
||||
|
||||
|
@ -2928,7 +2929,7 @@ out:
|
|||
f2fs_remove_dirty_inode(inode);
|
||||
submitted = NULL;
|
||||
}
|
||||
unlock_page(page);
|
||||
folio_unlock(folio);
|
||||
if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) &&
|
||||
!F2FS_I(inode)->wb_task && allow_balance)
|
||||
f2fs_balance_fs(sbi, need_balance_fs);
|
||||
|
@ -2946,7 +2947,7 @@ out:
|
|||
return 0;
|
||||
|
||||
redirty_out:
|
||||
redirty_page_for_writepage(wbc, page);
|
||||
folio_redirty_for_writepage(wbc, folio);
|
||||
/*
|
||||
* pageout() in MM translates EAGAIN, so calls handle_write_error()
|
||||
* -> mapping_set_error() -> set_bit(AS_EIO, ...).
|
||||
|
@ -2955,7 +2956,7 @@ redirty_out:
|
|||
*/
|
||||
if (!err || wbc->for_reclaim)
|
||||
return AOP_WRITEPAGE_ACTIVATE;
|
||||
unlock_page(page);
|
||||
folio_unlock(folio);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -2977,7 +2978,7 @@ static int f2fs_write_data_page(struct page *page,
|
|||
out:
|
||||
#endif
|
||||
|
||||
return f2fs_write_single_data_page(page, NULL, NULL, NULL,
|
||||
return f2fs_write_single_data_page(page_folio(page), NULL, NULL, NULL,
|
||||
wbc, FS_DATA_IO, 0, true);
|
||||
}
|
||||
|
||||
|
@ -3187,7 +3188,7 @@ continue_unlock:
|
|||
continue;
|
||||
}
|
||||
#endif
|
||||
ret = f2fs_write_single_data_page(&folio->page,
|
||||
ret = f2fs_write_single_data_page(folio,
|
||||
&submitted, &bio, &last_block,
|
||||
wbc, io_type, 0, true);
|
||||
if (ret == AOP_WRITEPAGE_ACTIVATE)
|
||||
|
|
|
@ -3875,7 +3875,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
|||
int f2fs_encrypt_one_page(struct f2fs_io_info *fio);
|
||||
bool f2fs_should_update_inplace(struct inode *inode, struct f2fs_io_info *fio);
|
||||
bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio);
|
||||
int f2fs_write_single_data_page(struct page *page, int *submitted,
|
||||
int f2fs_write_single_data_page(struct folio *folio, int *submitted,
|
||||
struct bio **bio, sector_t *last_block,
|
||||
struct writeback_control *wbc,
|
||||
enum iostat_type io_type,
|
||||
|
|
Loading…
Reference in New Issue
Block a user