]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
f2fs: support checkpoint error injection
authorChao Yu <yuchao0@huawei.com>
Mon, 26 Sep 2016 11:45:55 +0000 (19:45 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 1 Oct 2016 00:34:35 +0000 (17:34 -0700)
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: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/gc.c
fs/f2fs/segment.c
fs/f2fs/super.c

index 896ad9f883575ab7a61f876089f7d3e8d42cc38c..9e8de18a168af67782254796eb13b75068421619 100644 (file)
@@ -47,6 +47,7 @@ enum {
        FAULT_DIR_DEPTH,
        FAULT_EVICT_INODE,
        FAULT_IO,
+       FAULT_CHECKPOINT,
        FAULT_MAX,
 };
 
index a5c4175376ab1bdfb9887e475f6002a8cd898bde..c9b8a67671f16a35041f6e75188ea9e187dd9ecd 100644 (file)
@@ -47,6 +47,11 @@ static int gc_thread_func(void *data)
                        continue;
                }
 
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+               if (time_to_inject(sbi, FAULT_CHECKPOINT))
+                       f2fs_stop_checkpoint(sbi, false);
+#endif
+
                /*
                 * [GC triggering condition]
                 * 0. GC is not conducted currently.
index fbcc17254c05a2fd3b23141045db68c61fe11f8f..fc886f0084495e84234d49edd10d55422c7cb854 100644 (file)
@@ -345,6 +345,11 @@ int commit_inmem_pages(struct inode *inode)
  */
 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)
                return;
 
index 40aecd78ccccd77db09e5d32c31676b9fd6c9c37..6132b4ce4e4ce348eec2c7c33ddce3700cb14b1b 100644 (file)
@@ -50,6 +50,7 @@ char *fault_name[FAULT_MAX] = {
        [FAULT_DIR_DEPTH]       = "too big dir depth",
        [FAULT_EVICT_INODE]     = "evict_inode fail",
        [FAULT_IO]              = "IO error",
+       [FAULT_CHECKPOINT]      = "checkpoint error",
 };
 
 static void f2fs_build_fault_attr(struct f2fs_sb_info *sbi,