From: Chao Yu <yuchao0@huawei.com>
To: <jaegeuk@kernel.org>
Cc: <linux-f2fs-devel@lists.sourceforge.net>,
<linux-kernel@vger.kernel.org>, <chao@kernel.org>,
Chao Yu <yuchao0@huawei.com>
Subject: [PATCH 2/3] f2fs: support checkpoint error injection
Date: Fri, 23 Sep 2016 13:24:57 +0800 [thread overview]
Message-ID: <20160923052458.83849-2-yuchao0@huawei.com> (raw)
In-Reply-To: <20160923052458.83849-1-yuchao0@huawei.com>
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
next prev parent reply other threads:[~2016-09-23 5:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 5:24 [PATCH 1/3] f2fs: adjust display format of segment bit Chao Yu
2016-09-23 5:24 ` Chao Yu [this message]
2016-09-23 23:53 ` [PATCH 2/3] f2fs: support checkpoint error injection Jaegeuk Kim
2016-09-24 0:46 ` Chao Yu
2016-09-24 0:52 ` Jaegeuk Kim
2016-09-24 3:32 ` Chao Yu
2016-09-24 18:10 ` Jaegeuk Kim
2016-09-26 1:03 ` Chao Yu
2016-09-23 5:24 ` [PATCH 3/3] f2fs: fix potential deadlock when hitting checkpoint error Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160923052458.83849-2-yuchao0@huawei.com \
--to=yuchao0@huawei.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®