Skip to content

Commit aec2f72

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: clean up with clear_radix_tree_dirty_tag
Introduce clear_radix_tree_dirty_tag to include common codes for cleanup. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 64c74a7 commit aec2f72

5 files changed

Lines changed: 16 additions & 23 deletions

File tree

‎fs/f2fs/data.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,6 +2594,17 @@ const struct address_space_operations f2fs_dblock_aops = {
25942594
#endif
25952595
};
25962596

2597+
void clear_radix_tree_dirty_tag(struct page *page)
2598+
{
2599+
struct address_space *mapping = page_mapping(page);
2600+
unsigned long flags;
2601+
2602+
xa_lock_irqsave(&mapping->i_pages, flags);
2603+
radix_tree_tag_clear(&mapping->i_pages, page_index(page),
2604+
PAGECACHE_TAG_DIRTY);
2605+
xa_unlock_irqrestore(&mapping->i_pages, flags);
2606+
}
2607+
25972608
int __init f2fs_init_post_read_processing(void)
25982609
{
25992610
bio_post_read_ctx_cache = KMEM_CACHE(bio_post_read_ctx, 0);

‎fs/f2fs/dir.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,6 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
698698
struct f2fs_dentry_block *dentry_blk;
699699
unsigned int bit_pos;
700700
int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len));
701-
struct address_space *mapping = page_mapping(page);
702-
unsigned long flags;
703701
int i;
704702

705703
f2fs_update_time(F2FS_I_SB(dir), REQ_TIME);
@@ -732,11 +730,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
732730

733731
if (bit_pos == NR_DENTRY_IN_BLOCK &&
734732
!truncate_hole(dir, page->index, page->index + 1)) {
735-
xa_lock_irqsave(&mapping->i_pages, flags);
736-
radix_tree_tag_clear(&mapping->i_pages, page_index(page),
737-
PAGECACHE_TAG_DIRTY);
738-
xa_unlock_irqrestore(&mapping->i_pages, flags);
739-
733+
clear_radix_tree_dirty_tag(page);
740734
clear_page_dirty_for_io(page);
741735
ClearPagePrivate(page);
742736
ClearPageUptodate(page);

‎fs/f2fs/f2fs.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,6 +2965,7 @@ int f2fs_migrate_page(struct address_space *mapping, struct page *newpage,
29652965
struct page *page, enum migrate_mode mode);
29662966
#endif
29672967
bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len);
2968+
void clear_radix_tree_dirty_tag(struct page *page);
29682969

29692970
/*
29702971
* gc.c

‎fs/f2fs/inline.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page)
204204
{
205205
void *src_addr, *dst_addr;
206206
struct dnode_of_data dn;
207-
struct address_space *mapping = page_mapping(page);
208-
unsigned long flags;
209207
int err;
210208

211209
set_new_dnode(&dn, inode, NULL, NULL, 0);
@@ -227,10 +225,7 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page)
227225
kunmap_atomic(src_addr);
228226
set_page_dirty(dn.inode_page);
229227

230-
xa_lock_irqsave(&mapping->i_pages, flags);
231-
radix_tree_tag_clear(&mapping->i_pages, page_index(page),
232-
PAGECACHE_TAG_DIRTY);
233-
xa_unlock_irqrestore(&mapping->i_pages, flags);
228+
clear_radix_tree_dirty_tag(page);
234229

235230
set_inode_flag(inode, FI_APPEND_WRITE);
236231
set_inode_flag(inode, FI_DATA_EXIST);

‎fs/f2fs/node.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,10 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
102102

103103
static void clear_node_page_dirty(struct page *page)
104104
{
105-
struct address_space *mapping = page->mapping;
106-
unsigned int long flags;
107-
108105
if (PageDirty(page)) {
109-
xa_lock_irqsave(&mapping->i_pages, flags);
110-
radix_tree_tag_clear(&mapping->i_pages,
111-
page_index(page),
112-
PAGECACHE_TAG_DIRTY);
113-
xa_unlock_irqrestore(&mapping->i_pages, flags);
114-
106+
clear_radix_tree_dirty_tag(page);
115107
clear_page_dirty_for_io(page);
116-
dec_page_count(F2FS_M_SB(mapping), F2FS_DIRTY_NODES);
108+
dec_page_count(F2FS_P_SB(page), F2FS_DIRTY_NODES);
117109
}
118110
ClearPageUptodate(page);
119111
}

0 commit comments

Comments
 (0)