f2fs: Convert f2fs_set_data_page_dirty to f2fs_dirty_data_folio

Removes several calls to __set_page_dirty_nobuffers().  Also turn the
PageSwapCache() case into a BUG() as there's no way for a swapcache page
to make it to a filesystem that doesn't use SWP_FS_OPS.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Acked-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Tested-by: Mike Marshall <hubcap@omnibond.com> # orangefs
Tested-by: David Howells <dhowells@redhat.com> # afs
parent 1d9ac659
...@@ -1015,7 +1015,7 @@ static void __remove_dirty_inode(struct inode *inode, enum inode_type type) ...@@ -1015,7 +1015,7 @@ static void __remove_dirty_inode(struct inode *inode, enum inode_type type)
stat_dec_dirty_inode(F2FS_I_SB(inode), type); stat_dec_dirty_inode(F2FS_I_SB(inode), type);
} }
void f2fs_update_dirty_page(struct inode *inode, struct page *page) void f2fs_update_dirty_folio(struct inode *inode, struct folio *folio)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
enum inode_type type = S_ISDIR(inode->i_mode) ? DIR_INODE : FILE_INODE; enum inode_type type = S_ISDIR(inode->i_mode) ? DIR_INODE : FILE_INODE;
...@@ -1030,7 +1030,7 @@ void f2fs_update_dirty_page(struct inode *inode, struct page *page) ...@@ -1030,7 +1030,7 @@ void f2fs_update_dirty_page(struct inode *inode, struct page *page)
inode_inc_dirty_pages(inode); inode_inc_dirty_pages(inode);
spin_unlock(&sbi->inode_lock[type]); spin_unlock(&sbi->inode_lock[type]);
set_page_private_reference(page); set_page_private_reference(&folio->page);
} }
void f2fs_remove_dirty_inode(struct inode *inode) void f2fs_remove_dirty_inode(struct inode *inode)
......
...@@ -3548,35 +3548,35 @@ int f2fs_release_page(struct page *page, gfp_t wait) ...@@ -3548,35 +3548,35 @@ int f2fs_release_page(struct page *page, gfp_t wait)
return 1; return 1;
} }
static int f2fs_set_data_page_dirty(struct page *page) static bool f2fs_dirty_data_folio(struct address_space *mapping,
struct folio *folio)
{ {
struct inode *inode = page_file_mapping(page)->host; struct inode *inode = mapping->host;
trace_f2fs_set_page_dirty(page, DATA); trace_f2fs_set_page_dirty(&folio->page, DATA);
if (!PageUptodate(page)) if (!folio_test_uptodate(folio))
SetPageUptodate(page); folio_mark_uptodate(folio);
if (PageSwapCache(page)) BUG_ON(folio_test_swapcache(folio));
return __set_page_dirty_nobuffers(page);
if (f2fs_is_atomic_file(inode) && !f2fs_is_commit_atomic_write(inode)) { if (f2fs_is_atomic_file(inode) && !f2fs_is_commit_atomic_write(inode)) {
if (!page_private_atomic(page)) { if (!page_private_atomic(&folio->page)) {
f2fs_register_inmem_page(inode, page); f2fs_register_inmem_page(inode, &folio->page);
return 1; return true;
} }
/* /*
* Previously, this page has been registered, we just * Previously, this page has been registered, we just
* return here. * return here.
*/ */
return 0; return false;
} }
if (!PageDirty(page)) { if (!folio_test_dirty(folio)) {
__set_page_dirty_nobuffers(page); filemap_dirty_folio(mapping, folio);
f2fs_update_dirty_page(inode, page); f2fs_update_dirty_folio(inode, folio);
return 1; return true;
} }
return 0; return true;
} }
...@@ -3936,7 +3936,7 @@ const struct address_space_operations f2fs_dblock_aops = { ...@@ -3936,7 +3936,7 @@ const struct address_space_operations f2fs_dblock_aops = {
.writepages = f2fs_write_data_pages, .writepages = f2fs_write_data_pages,
.write_begin = f2fs_write_begin, .write_begin = f2fs_write_begin,
.write_end = f2fs_write_end, .write_end = f2fs_write_end,
.set_page_dirty = f2fs_set_data_page_dirty, .dirty_folio = f2fs_dirty_data_folio,
.invalidate_folio = f2fs_invalidate_folio, .invalidate_folio = f2fs_invalidate_folio,
.releasepage = f2fs_release_page, .releasepage = f2fs_release_page,
.direct_IO = noop_direct_IO, .direct_IO = noop_direct_IO,
......
...@@ -3597,7 +3597,7 @@ void f2fs_add_orphan_inode(struct inode *inode); ...@@ -3597,7 +3597,7 @@ void f2fs_add_orphan_inode(struct inode *inode);
void f2fs_remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino); void f2fs_remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino);
int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi); int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi);
int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi);
void f2fs_update_dirty_page(struct inode *inode, struct page *page); void f2fs_update_dirty_folio(struct inode *inode, struct folio *folio);
void f2fs_remove_dirty_inode(struct inode *inode); void f2fs_remove_dirty_inode(struct inode *inode);
int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type);
void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment