Commit 0f348028 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: support checkpoint error injection

This patch adds to support checkpoint error injection in f2fs for testing
fatal error tolerance, it will be useful that it can simulate abnormal
power off by f2fs itself instead of calling godown ioctl by running apps.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 2443b8b3
...@@ -47,6 +47,7 @@ enum { ...@@ -47,6 +47,7 @@ enum {
FAULT_DIR_DEPTH, FAULT_DIR_DEPTH,
FAULT_EVICT_INODE, FAULT_EVICT_INODE,
FAULT_IO, FAULT_IO,
FAULT_CHECKPOINT,
FAULT_MAX, FAULT_MAX,
}; };
......
...@@ -47,6 +47,11 @@ static int gc_thread_func(void *data) ...@@ -47,6 +47,11 @@ static int gc_thread_func(void *data)
continue; continue;
} }
#ifdef CONFIG_F2FS_FAULT_INJECTION
if (time_to_inject(sbi, FAULT_CHECKPOINT))
f2fs_stop_checkpoint(sbi, false);
#endif
/* /*
* [GC triggering condition] * [GC triggering condition]
* 0. GC is not conducted currently. * 0. GC is not conducted currently.
......
...@@ -345,6 +345,11 @@ int commit_inmem_pages(struct inode *inode) ...@@ -345,6 +345,11 @@ int commit_inmem_pages(struct inode *inode)
*/ */
void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need)
{ {
#ifdef CONFIG_F2FS_FAULT_INJECTION
if (time_to_inject(sbi, FAULT_CHECKPOINT))
f2fs_stop_checkpoint(sbi, false);
#endif
if (!need) if (!need)
return; return;
......
...@@ -50,6 +50,7 @@ char *fault_name[FAULT_MAX] = { ...@@ -50,6 +50,7 @@ char *fault_name[FAULT_MAX] = {
[FAULT_DIR_DEPTH] = "too big dir depth", [FAULT_DIR_DEPTH] = "too big dir depth",
[FAULT_EVICT_INODE] = "evict_inode fail", [FAULT_EVICT_INODE] = "evict_inode fail",
[FAULT_IO] = "IO error", [FAULT_IO] = "IO error",
[FAULT_CHECKPOINT] = "checkpoint error",
}; };
static void f2fs_build_fault_attr(struct f2fs_sb_info *sbi, static void f2fs_build_fault_attr(struct f2fs_sb_info *sbi,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment