aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorGravatar Chao Yu <yuchao0@huawei.com> 2016-09-18 23:30:07 +0800
committerGravatar Jaegeuk Kim <jaegeuk@kernel.org> 2016-09-22 11:43:06 -0700
commit8b038c70dfe4fd7b62573917a9e976f826ac6ad3 (patch)
tree175fe3a2f6b72002259feb601f0de64b77de20f1 /fs/f2fs/data.c
parentf2fs: fix to return error number of read_all_xattrs correctly (diff)
downloadlinux-8b038c70dfe4fd7b62573917a9e976f826ac6ad3.tar.gz
linux-8b038c70dfe4fd7b62573917a9e976f826ac6ad3.tar.bz2
linux-8b038c70dfe4fd7b62573917a9e976f826ac6ad3.zip
f2fs: support IO error injection
This patch adds to support IO error injection for testing IO error tolerance of f2fs. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 528c3c0d55a2..25e3c302b72f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -34,6 +34,11 @@ static void f2fs_read_end_io(struct bio *bio)
struct bio_vec *bvec;
int i;
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+ if (time_to_inject(FAULT_IO))
+ bio->bi_error = -EIO;
+#endif
+
if (f2fs_bio_encrypted(bio)) {
if (bio->bi_error) {
fscrypt_release_ctx(bio->bi_private);