[PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In come corner case, the reserved segments are used to do gc, and there are
not enough free segments for write checkpoint to finish its job, then the
gc process will fail to change the prefree segments to free segments.

Signed-off-by: Yunlong Song <yunlong.song@xxxxxxxxxx>
---
 fs/f2fs/gc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index cd147e7..6552b04 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1056,6 +1056,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,
 	if (!sync) {
 		if (has_not_enough_free_secs(sbi, sec_freed, 0)) {
 			segno = NULL_SEGNO;
+#ifndef CONFIG_F2FS_CHECK_FS
+			if (prefree_segments(sbi) &&
+				has_not_enough_free_secs(sbi,
+					reserved_sections(sbi), 0)) {
+				ret = write_checkpoint(sbi, &cpc);
+				if (ret)
+					goto stop;
+				sec_freed = 0;
+			}
+#endif
 			goto gc_more;
 		}
 
-- 
1.8.5.2




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux