From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B787C33ADA9 for ; Mon, 19 Jan 2026 14:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768834012; cv=none; b=kEn4+GnNqXzXhmNLNh10Ek/pc4C5ZQp7qFpjQLy8TlReaEmaUQbYRirOe0NcJxxmUgWGVs8vERaR/b2H++p2sq7Dd1YFKs2MhJe70J6ttV9Cr4WUgQLXFh7cUpgPdfd4y7RkPx56tSVzMJ4bdUs6FQAtFYuL9/n63DAIS6aRvro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768834012; c=relaxed/simple; bh=cpepyOoJYyqrPZNpjm50qjy8to4U+hnkpMNW8x4AblY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mGFpmtUqlfMdc8FbbaCChn+8AEkEBm41e05qZ0nxNxzxdcA1vL1IONctKsgxVbI6xFqfTGuOd84M/LQfxez+GwY7NEdwA99YgKbpjJPp/eilbiW/6OS27NRSGTBJ4MS0geMG85Qe0OutOnul0l4exH7FPPhvWKTMmDQDHgBxGF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uK5hUso0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uK5hUso0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC267C2BC87; Mon, 19 Jan 2026 14:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768834012; bh=cpepyOoJYyqrPZNpjm50qjy8to4U+hnkpMNW8x4AblY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uK5hUso0baL+dnPeqSOGm75+ZcRGbhrcp4pSAAR73EGl6uCAGEn2PKA7UTpjZaMnu YdcAEfBGbiaqrEOni6hoFjI+MC+vuFz6Aj21ENTFboUtATS6M1DMVlVbPquFLBwRdX W8/BjPbW4LQdkHlej4WCTSr2hsMWd7ti5vxekt7Buq9IjFYzgCz9w3E0KJ7jXex9XP RpH21Vn3IOgbLw/fp+SU8whSUg5F5hmFtcwCCRiedHavMTqXfdTTQ91+VPr1Hd+nC0 iB+xgFNL9vcb6X0d9kcqCDV3ruXuy/n8zPrOqg0kTS36JsGS5fgO4n7nPIq3WIwyeK G1hlyMk/QoUnQ== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 2/2] f2fs: introduce FAULT_SKIP_WRITE Date: Mon, 19 Jan 2026 21:32:30 +0800 Message-Id: <20260119133230.16481-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20260119133230.16481-1-chao@kernel.org> References: <20260119133230.16481-1-chao@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In order to simulate skipped write during enable_checkpoint(). Signed-off-by: Chao Yu --- 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//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 00108d5881aa..830c8090767e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2926,6 +2926,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