Skip to content

Commit 1120764

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: introduce FAULT_SKIP_WRITE
In order to simulate skipped write during enable_checkpoint(). Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent ab59919 commit 1120764

5 files changed

Lines changed: 8 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ Description: Support configuring fault injection type, should be
744744
FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms)
745745
FAULT_VMALLOC 0x00800000
746746
FAULT_LOCK_TIMEOUT 0x01000000 (1000ms)
747+
FAULT_SKIP_WRITE 0x02000000
747748
=========================== ==========
748749

749750
What: /sys/fs/f2fs/<disk>/discard_io_aware_gran

Documentation/filesystems/f2fs.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ fault_type=%d Support configuring fault injection type, should be
218218
FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms)
219219
FAULT_VMALLOC 0x00800000
220220
FAULT_LOCK_TIMEOUT 0x01000000 (1000ms)
221+
FAULT_SKIP_WRITE 0x02000000
221222
=========================== ==========
222223
mode=%s Control block allocation mode which supports "adaptive"
223224
and "lfs". In "lfs" mode, there should be no random

fs/f2fs/data.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,6 +2921,10 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
29212921
goto got_it;
29222922
}
29232923

2924+
if (is_sbi_flag_set(fio->sbi, SBI_ENABLE_CHECKPOINT) &&
2925+
time_to_inject(fio->sbi, FAULT_SKIP_WRITE))
2926+
return -EINVAL;
2927+
29242928
/* Deadlock due to between page->lock and f2fs_lock_op */
29252929
if (fio->need_lock == LOCK_REQ && !f2fs_trylock_op(fio->sbi, &lc))
29262930
return -EAGAIN;

fs/f2fs/f2fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum {
6666
FAULT_ATOMIC_TIMEOUT,
6767
FAULT_VMALLOC,
6868
FAULT_LOCK_TIMEOUT,
69+
FAULT_SKIP_WRITE,
6970
FAULT_MAX,
7071
};
7172

fs/f2fs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const char *f2fs_fault_name[FAULT_MAX] = {
7070
[FAULT_ATOMIC_TIMEOUT] = "atomic timeout",
7171
[FAULT_VMALLOC] = "vmalloc",
7272
[FAULT_LOCK_TIMEOUT] = "lock timeout",
73+
[FAULT_SKIP_WRITE] = "skip write",
7374
};
7475

7576
int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate,

0 commit comments

Comments
 (0)