Skip to content

Commit bcf4d2d

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: convert f2fs_do_write_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/[email protected]/ Cc: Matthew Wilcox <[email protected]> Signed-off-by: Chao Yu <[email protected]> Reviewed-by: Li Zetao <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 1efc783 commit bcf4d2d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

fs/f2fs/data.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,8 +2648,8 @@ static inline bool need_inplace_update(struct f2fs_io_info *fio)
26482648

26492649
int f2fs_do_write_data_page(struct f2fs_io_info *fio)
26502650
{
2651-
struct page *page = fio->page;
2652-
struct inode *inode = page->mapping->host;
2651+
struct folio *folio = page_folio(fio->page);
2652+
struct inode *inode = folio->mapping->host;
26532653
struct dnode_of_data dn;
26542654
struct node_info ni;
26552655
bool ipu_force = false;
@@ -2658,14 +2658,14 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
26582658

26592659
/* Use COW inode to make dnode_of_data for atomic write */
26602660
atomic_commit = f2fs_is_atomic_file(inode) &&
2661-
page_private_atomic(fio->page);
2661+
page_private_atomic(folio_page(folio, 0));
26622662
if (atomic_commit)
26632663
set_new_dnode(&dn, F2FS_I(inode)->cow_inode, NULL, NULL, 0);
26642664
else
26652665
set_new_dnode(&dn, inode, NULL, NULL, 0);
26662666

26672667
if (need_inplace_update(fio) &&
2668-
f2fs_lookup_read_extent_cache_block(inode, page->index,
2668+
f2fs_lookup_read_extent_cache_block(inode, folio->index,
26692669
&fio->old_blkaddr)) {
26702670
if (!f2fs_is_valid_blkaddr(fio->sbi, fio->old_blkaddr,
26712671
DATA_GENERIC_ENHANCE))
@@ -2680,16 +2680,16 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
26802680
if (fio->need_lock == LOCK_REQ && !f2fs_trylock_op(fio->sbi))
26812681
return -EAGAIN;
26822682

2683-
err = f2fs_get_dnode_of_data(&dn, page->index, LOOKUP_NODE);
2683+
err = f2fs_get_dnode_of_data(&dn, folio->index, LOOKUP_NODE);
26842684
if (err)
26852685
goto out;
26862686

26872687
fio->old_blkaddr = dn.data_blkaddr;
26882688

26892689
/* This page is already truncated */
26902690
if (fio->old_blkaddr == NULL_ADDR) {
2691-
ClearPageUptodate(page);
2692-
clear_page_private_gcing(page);
2691+
folio_clear_uptodate(folio);
2692+
clear_page_private_gcing(folio_page(folio, 0));
26932693
goto out_writepage;
26942694
}
26952695
got_it:
@@ -2715,19 +2715,19 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
27152715
if (err)
27162716
goto out_writepage;
27172717

2718-
set_page_writeback(page);
2718+
folio_start_writeback(folio);
27192719
f2fs_put_dnode(&dn);
27202720
if (fio->need_lock == LOCK_REQ)
27212721
f2fs_unlock_op(fio->sbi);
27222722
err = f2fs_inplace_write_data(fio);
27232723
if (err) {
27242724
if (fscrypt_inode_uses_fs_layer_crypto(inode))
27252725
fscrypt_finalize_bounce_page(&fio->encrypted_page);
2726-
end_page_writeback(page);
2726+
folio_end_writeback(folio);
27272727
} else {
27282728
set_inode_flag(inode, FI_UPDATE_WRITE);
27292729
}
2730-
trace_f2fs_do_write_data_page(page_folio(page), IPU);
2730+
trace_f2fs_do_write_data_page(folio, IPU);
27312731
return err;
27322732
}
27332733

@@ -2749,17 +2749,17 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
27492749
if (err)
27502750
goto out_writepage;
27512751

2752-
set_page_writeback(page);
2752+
folio_start_writeback(folio);
27532753

27542754
if (fio->compr_blocks && fio->old_blkaddr == COMPRESS_ADDR)
27552755
f2fs_i_compr_blocks_update(inode, fio->compr_blocks - 1, false);
27562756

27572757
/* LFS mode write path */
27582758
f2fs_outplace_write_data(&dn, fio);
2759-
trace_f2fs_do_write_data_page(page_folio(page), OPU);
2759+
trace_f2fs_do_write_data_page(folio, OPU);
27602760
set_inode_flag(inode, FI_APPEND_WRITE);
27612761
if (atomic_commit)
2762-
clear_page_private_atomic(page);
2762+
clear_page_private_atomic(folio_page(folio, 0));
27632763
out_writepage:
27642764
f2fs_put_dnode(&dn);
27652765
out:

0 commit comments

Comments
 (0)