提交 10027551 编写于 作者: J Jaegeuk Kim

f2fs: pass checkpoint reason on roll-forward recovery

This patch adds CP_RECOVERY to remain recovery information for checkpoint.
And, it makes sure writing checkpoint in this case.
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 feb7cbb0
...@@ -1051,7 +1051,7 @@ void write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) ...@@ -1051,7 +1051,7 @@ void write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
mutex_lock(&sbi->cp_mutex); mutex_lock(&sbi->cp_mutex);
if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) && if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) &&
cpc->reason != CP_DISCARD && cpc->reason != CP_UMOUNT) (cpc->reason == CP_FASTBOOT || cpc->reason == CP_SYNC))
goto out; goto out;
if (unlikely(f2fs_cp_error(sbi))) if (unlikely(f2fs_cp_error(sbi)))
goto out; goto out;
...@@ -1086,6 +1086,10 @@ void write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) ...@@ -1086,6 +1086,10 @@ void write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
unblock_operations(sbi); unblock_operations(sbi);
stat_inc_cp_count(sbi->stat_info); stat_inc_cp_count(sbi->stat_info);
if (cpc->reason == CP_RECOVERY)
f2fs_msg(sbi->sb, KERN_NOTICE,
"checkpoint: version = %llx", ckpt_ver);
out: out:
mutex_unlock(&sbi->cp_mutex); mutex_unlock(&sbi->cp_mutex);
trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint"); trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint");
......
...@@ -103,6 +103,7 @@ enum { ...@@ -103,6 +103,7 @@ enum {
CP_UMOUNT, CP_UMOUNT,
CP_FASTBOOT, CP_FASTBOOT,
CP_SYNC, CP_SYNC,
CP_RECOVERY,
CP_DISCARD, CP_DISCARD,
}; };
......
...@@ -564,7 +564,7 @@ int recover_fsync_data(struct f2fs_sb_info *sbi) ...@@ -564,7 +564,7 @@ int recover_fsync_data(struct f2fs_sb_info *sbi)
mutex_unlock(&sbi->cp_mutex); mutex_unlock(&sbi->cp_mutex);
} else if (need_writecp) { } else if (need_writecp) {
struct cp_control cpc = { struct cp_control cpc = {
.reason = CP_SYNC, .reason = CP_RECOVERY,
}; };
mutex_unlock(&sbi->cp_mutex); mutex_unlock(&sbi->cp_mutex);
write_checkpoint(sbi, &cpc); write_checkpoint(sbi, &cpc);
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
{ CP_UMOUNT, "Umount" }, \ { CP_UMOUNT, "Umount" }, \
{ CP_FASTBOOT, "Fastboot" }, \ { CP_FASTBOOT, "Fastboot" }, \
{ CP_SYNC, "Sync" }, \ { CP_SYNC, "Sync" }, \
{ CP_RECOVERY, "Recovery" }, \
{ CP_DISCARD, "Discard" }) { CP_DISCARD, "Discard" })
struct victim_sel_policy; struct victim_sel_policy;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册