Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1489763

[PATCH 2/3] f2fs: support checkpoint error injection

From Chao Yu <yuchao0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] f2fs: support checkpoint error injection
Date 2016-09-23 07:30 +0200
Message-ID <skrdE-7Yp-31@gated-at.bofh.it> (permalink)
References <skrdE-7Yp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch adds to support checkpoint error injection in f2fs for testing
fatal error tolerance.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/f2fs.h  | 7 +++++++
 fs/f2fs/super.c | 1 +
 2 files changed, 8 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e216bc0..3c513fe 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -47,6 +47,7 @@ enum {
 	FAULT_DIR_DEPTH,
 	FAULT_EVICT_INODE,
 	FAULT_IO,
+	FAULT_CHECKPOINT,
 	FAULT_MAX,
 };
 
@@ -80,6 +81,8 @@ static inline bool time_to_inject(int type)
 		return false;
 	else if (type == FAULT_IO && !IS_FAULT_SET(type))
 		return false;
+	else if (type == FAULT_CHECKPOINT && !IS_FAULT_SET(type))
+		return false;
 
 	atomic_inc(&f2fs_fault.inject_ops);
 	if (atomic_read(&f2fs_fault.inject_ops) >= f2fs_fault.inject_rate) {
@@ -1873,6 +1876,10 @@ static inline int f2fs_readonly(struct super_block *sb)
 
 static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi)
 {
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+	if (time_to_inject(FAULT_CHECKPOINT))
+		return true;
+#endif
 	return is_set_ckpt_flags(sbi, CP_ERROR_FLAG);
 }
 
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 6426855..3c49419 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -51,6 +51,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(unsigned int rate)
-- 
2.8.2.311.gee88674

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] f2fs: adjust display format of segment bit Chao Yu <yuchao0@huawei.com> - 2016-09-23 07:30 +0200
  [PATCH 2/3] f2fs: support checkpoint error injection Chao Yu <yuchao0@huawei.com> - 2016-09-23 07:30 +0200
    Re: [PATCH 2/3] f2fs: support checkpoint error injection Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-24 02:00 +0200
      Re: [PATCH 2/3] f2fs: support checkpoint error injection Chao Yu <yuchao0@huawei.com> - 2016-09-24 02:50 +0200
        Re: [PATCH 2/3] f2fs: support checkpoint error injection Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-24 03:00 +0200
          Re: [PATCH 2/3] f2fs: support checkpoint error injection Chao Yu <yuchao0@huawei.com> - 2016-09-24 05:40 +0200
            Re: [PATCH 2/3] f2fs: support checkpoint error injection Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-24 20:20 +0200
              Re: [PATCH 2/3] f2fs: support checkpoint error injection Chao Yu <yuchao0@huawei.com> - 2016-09-26 03:10 +0200
  [PATCH 3/3] f2fs: fix potential deadlock when hitting checkpoint error Chao Yu <yuchao0@huawei.com> - 2016-09-23 07:30 +0200

csiph-web