From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>
Subject: [PATCH v2 2/2] f2fs: introduce FAULT_SKIP_WRITE
Date: Tue, 20 Jan 2026 17:12:15 +0800 [thread overview]
Message-ID: <20260120091215.62608-2-chao@kernel.org> (raw)
In-Reply-To: <20260120091215.62608-1-chao@kernel.org>
In order to simulate skipped write during enable_checkpoint().
Signed-off-by: Chao Yu <chao@kernel.org>
---
v2:
- no changes
Documentation/ABI/testing/sysfs-fs-f2fs | 1 +
Documentation/filesystems/f2fs.rst | 1 +
fs/f2fs/data.c | 4 ++++
fs/f2fs/f2fs.h | 1 +
fs/f2fs/super.c | 1 +
5 files changed, 8 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 7398b369784c..9a8ec2290f68 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -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
diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
index fc005f2eaf86..7e4031631286 100644
--- a/Documentation/filesystems/f2fs.rst
+++ b/Documentation/filesystems/f2fs.rst
@@ -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
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 25b4d3f21fa7..9ef875e7b34c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 52cec6b3ecf0..3a8e1dcdcd69 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -66,6 +66,7 @@ enum {
FAULT_ATOMIC_TIMEOUT,
FAULT_VMALLOC,
FAULT_LOCK_TIMEOUT,
+ FAULT_SKIP_WRITE,
FAULT_MAX,
};
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0afe9f829058..5d8b2e812340 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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,
--
2.40.1
next prev parent reply other threads:[~2026-01-20 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 9:12 [PATCH v2 1/2] f2fs: check skipped write in f2fs_enable_checkpoint() Chao Yu
2026-01-20 9:12 ` Chao Yu [this message]
2026-01-22 23:50 ` [f2fs-dev] " patchwork-bot+f2fs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260120091215.62608-2-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox