aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-06 20:00:06 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-17 00:58:53 -0500
commit1fe54f9dd3acfaa3ed4e1d1e3278fd0f1d1e98cd (patch)
tree3b2859ffd3db7678bf7a284344ab12d3cfa3210a
parent203681f65b07055259bd475a6281136615b4e9a4 (diff)
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>
-rw-r--r--fs/f2fs/checkpoint.c1
-rw-r--r--fs/f2fs/data.c11
-rw-r--r--fs/f2fs/dir.c4
-rw-r--r--fs/f2fs/f2fs.h5
-rw-r--r--fs/f2fs/gc.c7
5 files changed, 10 insertions, 18 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 8f5dff1989a8..427dd55cfd5a 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -508,7 +508,6 @@ void set_dirty_dir_page(struct inode *inode, struct page *page)
508 if (__add_dirty_inode(inode, new)) 508 if (__add_dirty_inode(inode, new))
509 kmem_cache_free(inode_entry_slab, new); 509 kmem_cache_free(inode_entry_slab, new);
510 510
511 inc_page_count(sbi, F2FS_DIRTY_DENTS);
512 inode_inc_dirty_dents(inode); 511 inode_inc_dirty_dents(inode);
513 SetPagePrivate(page); 512 SetPagePrivate(page);
514 spin_unlock(&sbi->dir_inode_lock); 513 spin_unlock(&sbi->dir_inode_lock);
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d175ae3b612a..b401be71ecbd 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -799,10 +799,7 @@ static int f2fs_write_data_page(struct page *page,
799 */ 799 */
800 offset = i_size & (PAGE_CACHE_SIZE - 1); 800 offset = i_size & (PAGE_CACHE_SIZE - 1);
801 if ((page->index >= end_index + 1) || !offset) { 801 if ((page->index >= end_index + 1) || !offset) {
802 if (S_ISDIR(inode->i_mode)) { 802 inode_dec_dirty_dents(inode);
803 dec_page_count(sbi, F2FS_DIRTY_DENTS);
804 inode_dec_dirty_dents(inode);
805 }
806 goto out; 803 goto out;
807 } 804 }
808 805
@@ -815,7 +812,6 @@ write:
815 812
816 /* Dentry blocks are controlled by checkpoint */ 813 /* Dentry blocks are controlled by checkpoint */
817 if (S_ISDIR(inode->i_mode)) { 814 if (S_ISDIR(inode->i_mode)) {
818 dec_page_count(sbi, F2FS_DIRTY_DENTS);
819 inode_dec_dirty_dents(inode); 815 inode_dec_dirty_dents(inode);
820 err = do_write_data_page(page, &fio); 816 err = do_write_data_page(page, &fio);
821 } else { 817 } else {
@@ -1033,11 +1029,8 @@ static void f2fs_invalidate_data_page(struct page *page, unsigned int offset,
1033 unsigned int length) 1029 unsigned int length)
1034{ 1030{
1035 struct inode *inode = page->mapping->host; 1031 struct inode *inode = page->mapping->host;
1036 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 1032 if (PageDirty(page))
1037 if (S_ISDIR(inode->i_mode) && PageDirty(page)) {
1038 dec_page_count(sbi, F2FS_DIRTY_DENTS);
1039 inode_dec_dirty_dents(inode); 1033 inode_dec_dirty_dents(inode);
1040 }
1041 ClearPagePrivate(page); 1034 ClearPagePrivate(page);
1042} 1035}
1043 1036
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 5bbf94c31180..d5a2c9ed9aa7 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -532,7 +532,6 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
532 unsigned int bit_pos; 532 unsigned int bit_pos;
533 struct address_space *mapping = page->mapping; 533 struct address_space *mapping = page->mapping;
534 struct inode *dir = mapping->host; 534 struct inode *dir = mapping->host;
535 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
536 int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len)); 535 int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len));
537 void *kaddr = page_address(page); 536 void *kaddr = page_address(page);
538 int i; 537 int i;
@@ -555,6 +554,8 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
555 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 554 dir->i_ctime = dir->i_mtime = CURRENT_TIME;
556 555
557 if (inode) { 556 if (inode) {
557 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
558
558 if (S_ISDIR(inode->i_mode)) { 559 if (S_ISDIR(inode->i_mode)) {
559 drop_nlink(dir); 560 drop_nlink(dir);
560 update_inode_page(dir); 561 update_inode_page(dir);
@@ -577,7 +578,6 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
577 truncate_hole(dir, page->index, page->index + 1); 578 truncate_hole(dir, page->index, page->index + 1);
578 clear_page_dirty_for_io(page); 579 clear_page_dirty_for_io(page);
579 ClearPageUptodate(page); 580 ClearPageUptodate(page);
580 dec_page_count(sbi, F2FS_DIRTY_DENTS);
581 inode_dec_dirty_dents(dir); 581 inode_dec_dirty_dents(dir);
582 } 582 }
583 f2fs_put_page(page, 1); 583 f2fs_put_page(page, 1);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index aeff1327f9ed..4841d1225ea0 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -662,6 +662,7 @@ static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
662 662
663static inline void inode_inc_dirty_dents(struct inode *inode) 663static inline void inode_inc_dirty_dents(struct inode *inode)
664{ 664{
665 inc_page_count(F2FS_SB(inode->i_sb), F2FS_DIRTY_DENTS);
665 atomic_inc(&F2FS_I(inode)->dirty_dents); 666 atomic_inc(&F2FS_I(inode)->dirty_dents);
666} 667}
667 668
@@ -672,6 +673,10 @@ static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type)
672 673
673static inline void inode_dec_dirty_dents(struct inode *inode) 674static inline void inode_dec_dirty_dents(struct inode *inode)
674{ 675{
676 if (!S_ISDIR(inode->i_mode))
677 return;
678
679 dec_page_count(F2FS_SB(inode->i_sb), F2FS_DIRTY_DENTS);
675 atomic_dec(&F2FS_I(inode)->dirty_dents); 680 atomic_dec(&F2FS_I(inode)->dirty_dents);
676} 681}
677 682
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index b0f57628fe55..b161db4a96a4 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -531,15 +531,10 @@ static void move_data_page(struct inode *inode, struct page *page, int gc_type)
531 set_page_dirty(page); 531 set_page_dirty(page);
532 set_cold_data(page); 532 set_cold_data(page);
533 } else { 533 } else {
534 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
535
536 f2fs_wait_on_page_writeback(page, DATA); 534 f2fs_wait_on_page_writeback(page, DATA);
537 535
538 if (clear_page_dirty_for_io(page) && 536 if (clear_page_dirty_for_io(page))
539 S_ISDIR(inode->i_mode)) {
540 dec_page_count(sbi, F2FS_DIRTY_DENTS);
541 inode_dec_dirty_dents(inode); 537 inode_dec_dirty_dents(inode);
542 }
543 set_cold_data(page); 538 set_cold_data(page);
544 do_write_data_page(page, &fio); 539 do_write_data_page(page, &fio);
545 clear_cold_data(page); 540 clear_cold_data(page);