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>
This commit is contained in:
Chao Yu 2026-01-20 17:12:15 +08:00 committed by Jaegeuk Kim
parent ab59919c8a
commit 1120764691
5 changed files with 8 additions and 0 deletions

View file

@ -744,6 +744,7 @@ Description: Support configuring fault injection type, should be
FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms)
FAULT_VMALLOC 0x00800000
FAULT_LOCK_TIMEOUT 0x01000000 (1000ms)
FAULT_SKIP_WRITE 0x02000000
=========================== ==========
What: /sys/fs/f2fs/<disk>/discard_io_aware_gran

View file

@ -218,6 +218,7 @@ fault_type=%d Support configuring fault injection type, should be
FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms)
FAULT_VMALLOC 0x00800000
FAULT_LOCK_TIMEOUT 0x01000000 (1000ms)
FAULT_SKIP_WRITE 0x02000000
=========================== ==========
mode=%s Control block allocation mode which supports "adaptive"
and "lfs". In "lfs" mode, there should be no random

View file

@ -2921,6 +2921,10 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
goto got_it;
}
if (is_sbi_flag_set(fio->sbi, SBI_ENABLE_CHECKPOINT) &&
time_to_inject(fio->sbi, FAULT_SKIP_WRITE))
return -EINVAL;
/* Deadlock due to between page->lock and f2fs_lock_op */
if (fio->need_lock == LOCK_REQ && !f2fs_trylock_op(fio->sbi, &lc))
return -EAGAIN;

View file

@ -66,6 +66,7 @@ enum {
FAULT_ATOMIC_TIMEOUT,
FAULT_VMALLOC,
FAULT_LOCK_TIMEOUT,
FAULT_SKIP_WRITE,
FAULT_MAX,
};

View file

@ -70,6 +70,7 @@ const char *f2fs_fault_name[FAULT_MAX] = {
[FAULT_ATOMIC_TIMEOUT] = "atomic timeout",
[FAULT_VMALLOC] = "vmalloc",
[FAULT_LOCK_TIMEOUT] = "lock timeout",
[FAULT_SKIP_WRITE] = "skip write",
};
int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate,