f2fs: clean up redundant function call

This patch integrates inode_[inc|dec]_dirty_dents with inc_page_count to remove
redundant calls.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Jaegeuk Kim 2014-02-07 10:00:06 +09:00
parent 203681f65b
commit 1fe54f9dd3
5 changed files with 10 additions and 18 deletions

View file

@ -508,7 +508,6 @@ void set_dirty_dir_page(struct inode *inode, struct page *page)
if (__add_dirty_inode(inode, new)) if (__add_dirty_inode(inode, new))
kmem_cache_free(inode_entry_slab, new); kmem_cache_free(inode_entry_slab, new);
inc_page_count(sbi, F2FS_DIRTY_DENTS);
inode_inc_dirty_dents(inode); inode_inc_dirty_dents(inode);
SetPagePrivate(page); SetPagePrivate(page);
spin_unlock(&sbi->dir_inode_lock); spin_unlock(&sbi->dir_inode_lock);

View file

@ -799,10 +799,7 @@ static int f2fs_write_data_page(struct page *page,
*/ */
offset = i_size & (PAGE_CACHE_SIZE - 1); offset = i_size & (PAGE_CACHE_SIZE - 1);
if ((page->index >= end_index + 1) || !offset) { if ((page->index >= end_index + 1) || !offset) {
if (S_ISDIR(inode->i_mode)) { inode_dec_dirty_dents(inode);
dec_page_count(sbi, F2FS_DIRTY_DENTS);
inode_dec_dirty_dents(inode);
}
goto out; goto out;
} }
@ -815,7 +812,6 @@ static int f2fs_write_data_page(struct page *page,
/* Dentry blocks are controlled by checkpoint */ /* Dentry blocks are controlled by checkpoint */
if (S_ISDIR(inode->i_mode)) { if (S_ISDIR(inode->i_mode)) {
dec_page_count(sbi, F2FS_DIRTY_DENTS);
inode_dec_dirty_dents(inode); inode_dec_dirty_dents(inode);
err = do_write_data_page(page, &fio); err = do_write_data_page(page, &fio);
} else { } else {
@ -1033,11 +1029,8 @@ static void f2fs_invalidate_data_page(struct page *page, unsigned int offset,
unsigned int length) unsigned int length)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); if (PageDirty(page))
if (S_ISDIR(inode->i_mode) && PageDirty(page)) {
dec_page_count(sbi, F2FS_DIRTY_DENTS);
inode_dec_dirty_dents(inode); inode_dec_dirty_dents(inode);
}
ClearPagePrivate(page); ClearPagePrivate(page);
} }

View file

@ -532,7 +532,6 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
unsigned int bit_pos; unsigned int bit_pos;
struct address_space *mapping = page->mapping; struct address_space *mapping = page->mapping;
struct inode *dir = mapping->host; struct inode *dir = mapping->host;
struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len)); int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len));
void *kaddr = page_address(page); void *kaddr = page_address(page);
int i; int i;
@ -555,6 +554,8 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
dir->i_ctime = dir->i_mtime = CURRENT_TIME; dir->i_ctime = dir->i_mtime = CURRENT_TIME;
if (inode) { if (inode) {
struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
if (S_ISDIR(inode->i_mode)) { if (S_ISDIR(inode->i_mode)) {
drop_nlink(dir); drop_nlink(dir);
update_inode_page(dir); update_inode_page(dir);
@ -577,7 +578,6 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
truncate_hole(dir, page->index, page->index + 1); truncate_hole(dir, page->index, page->index + 1);
clear_page_dirty_for_io(page); clear_page_dirty_for_io(page);
ClearPageUptodate(page); ClearPageUptodate(page);
dec_page_count(sbi, F2FS_DIRTY_DENTS);
inode_dec_dirty_dents(dir); inode_dec_dirty_dents(dir);
} }
f2fs_put_page(page, 1); f2fs_put_page(page, 1);

View file

@ -662,6 +662,7 @@ static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
static inline void inode_inc_dirty_dents(struct inode *inode) static inline void inode_inc_dirty_dents(struct inode *inode)
{ {
inc_page_count(F2FS_SB(inode->i_sb), F2FS_DIRTY_DENTS);
atomic_inc(&F2FS_I(inode)->dirty_dents); atomic_inc(&F2FS_I(inode)->dirty_dents);
} }
@ -672,6 +673,10 @@ static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type)
static inline void inode_dec_dirty_dents(struct inode *inode) static inline void inode_dec_dirty_dents(struct inode *inode)
{ {
if (!S_ISDIR(inode->i_mode))
return;
dec_page_count(F2FS_SB(inode->i_sb), F2FS_DIRTY_DENTS);
atomic_dec(&F2FS_I(inode)->dirty_dents); atomic_dec(&F2FS_I(inode)->dirty_dents);
} }

View file

@ -531,15 +531,10 @@ static void move_data_page(struct inode *inode, struct page *page, int gc_type)
set_page_dirty(page); set_page_dirty(page);
set_cold_data(page); set_cold_data(page);
} else { } else {
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
f2fs_wait_on_page_writeback(page, DATA); f2fs_wait_on_page_writeback(page, DATA);
if (clear_page_dirty_for_io(page) && if (clear_page_dirty_for_io(page))
S_ISDIR(inode->i_mode)) {
dec_page_count(sbi, F2FS_DIRTY_DENTS);
inode_dec_dirty_dents(inode); inode_dec_dirty_dents(inode);
}
set_cold_data(page); set_cold_data(page);
do_write_data_page(page, &fio); do_write_data_page(page, &fio);
clear_cold_data(page); clear_cold_data(page);