aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/gc.c8
-rw-r--r--fs/f2fs/node.c2
-rw-r--r--fs/f2fs/super.c7
3 files changed, 7 insertions, 10 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 136c0f7a670b..e97f30157aa6 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -642,12 +642,6 @@ static void do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno,
642 if (IS_ERR(sum_page)) 642 if (IS_ERR(sum_page))
643 return; 643 return;
644 644
645 /*
646 * CP needs to lock sum_page. In this time, we don't need
647 * to lock this page, because this summary page is not gone anywhere.
648 * Also, this page is not gonna be updated before GC is done.
649 */
650 unlock_page(sum_page);
651 sum = page_address(sum_page); 645 sum = page_address(sum_page);
652 646
653 switch (GET_SUM_TYPE((&sum->footer))) { 647 switch (GET_SUM_TYPE((&sum->footer))) {
@@ -661,7 +655,7 @@ static void do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno,
661 stat_inc_seg_count(sbi, GET_SUM_TYPE((&sum->footer))); 655 stat_inc_seg_count(sbi, GET_SUM_TYPE((&sum->footer)));
662 stat_inc_call_count(sbi->stat_info); 656 stat_inc_call_count(sbi->stat_info);
663 657
664 f2fs_put_page(sum_page, 0); 658 f2fs_put_page(sum_page, 1);
665} 659}
666 660
667int f2fs_gc(struct f2fs_sb_info *sbi) 661int f2fs_gc(struct f2fs_sb_info *sbi)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 8510c5ed402e..95298ef68262 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1149,7 +1149,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,
1149 1149
1150 /* First check balancing cached NAT entries */ 1150 /* First check balancing cached NAT entries */
1151 if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) { 1151 if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) {
1152 write_checkpoint(sbi, false); 1152 f2fs_sync_fs(sbi->sb, true);
1153 return 0; 1153 return 0;
1154 } 1154 }
1155 1155
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 728c20a8e456..ca5413346653 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -137,10 +137,13 @@ int f2fs_sync_fs(struct super_block *sb, int sync)
137 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) 137 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES))
138 return 0; 138 return 0;
139 139
140 if (sync) 140 if (sync) {
141 mutex_lock(&sbi->gc_mutex);
141 write_checkpoint(sbi, false); 142 write_checkpoint(sbi, false);
142 else 143 mutex_unlock(&sbi->gc_mutex);
144 } else {
143 f2fs_balance_fs(sbi); 145 f2fs_balance_fs(sbi);
146 }
144 147
145 return 0; 148 return 0;
146} 149}