aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-09-12 09:22:29 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-09-12 13:07:32 -0700
commit6f5c2ed0a26fae6904a88622c126dfb9369548a3 (patch)
tree40c3e2ae7e087365d7648e840d820e1090837d56 /fs/f2fs/data.c
parentf2fs: add SPDX license identifiers (diff)
downloadwireguard-linux-6f5c2ed0a26fae6904a88622c126dfb9369548a3.tar.xz
wireguard-linux-6f5c2ed0a26fae6904a88622c126dfb9369548a3.zip
f2fs: split IO error injection according to RW
This patch adds to support injecting error for write IO, this can simulate IO error like fail_make_request or dm_flakey does. 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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c8c4b54e2bbf..57c0823d22e0 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -123,8 +123,9 @@ static bool f2fs_bio_post_read_required(struct bio *bio)
static void f2fs_read_end_io(struct bio *bio)
{
- if (time_to_inject(F2FS_P_SB(bio_first_page_all(bio)), FAULT_IO)) {
- f2fs_show_injection_info(FAULT_IO);
+ if (time_to_inject(F2FS_P_SB(bio_first_page_all(bio)),
+ FAULT_READ_IO)) {
+ f2fs_show_injection_info(FAULT_READ_IO);
bio->bi_status = BLK_STS_IOERR;
}
@@ -145,6 +146,11 @@ static void f2fs_write_end_io(struct bio *bio)
struct bio_vec *bvec;
int i;
+ if (time_to_inject(sbi, FAULT_WRITE_IO)) {
+ f2fs_show_injection_info(FAULT_WRITE_IO);
+ bio->bi_status = BLK_STS_IOERR;
+ }
+
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
enum count_type type = WB_DATA_TYPE(page);