]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
f2fs: introduce FAULT_SKIP_WRITE
authorChao Yu <chao@kernel.org>
Tue, 20 Jan 2026 09:12:15 +0000 (17:12 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 27 Jan 2026 02:45:58 +0000 (02:45 +0000)
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>
Documentation/ABI/testing/sysfs-fs-f2fs
Documentation/filesystems/f2fs.rst
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/super.c

index 7398b369784c7614cae7def42fc72cc71bf5e8b5..9a8ec2290f6885e3f461c653a0455e2251d371e6 100644 (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
index fc005f2eaf86b999b32d8932a41f2abc933dfd2f..7e40316312867cf4586ad13b1d6c4c787bc9de43 100644 (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
index 25b4d3f21fa7658196ed14044e96698f83e259f8..9ef875e7b34c19642cc661cac8aacd7f52165c99 100644 (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;
index 52cec6b3ecf0b7be4888522ebd89bb8e00ea01ac..3a8e1dcdcd69f09062d88a8c1913f4dde041df9d 100644 (file)
@@ -66,6 +66,7 @@ enum {
        FAULT_ATOMIC_TIMEOUT,
        FAULT_VMALLOC,
        FAULT_LOCK_TIMEOUT,
+       FAULT_SKIP_WRITE,
        FAULT_MAX,
 };
 
index 0afe9f829058a1ead1f2e019f044ec06288f1158..5d8b2e8123404fc519d7f018dcd0a6fa49bb943a 100644 (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,