All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] f2fs/014: test for missing 'trimmed' flag issue
@ 2025-05-26  8:03 ` Chunhai Guo via Linux-f2fs-devel
  0 siblings, 0 replies; 6+ messages in thread
From: Chunhai Guo @ 2025-05-26  8:03 UTC (permalink / raw)
  To: zlang, fstests; +Cc: chao, jaegeuk, linux-f2fs-devel, Chunhai Guo

This is a regression test case to verify whether the CP_TRIMMED_FLAG is
properly set after performing the following steps:
1. mount the f2fs filesystem
2. create a file, write data to it, then delete the file
3. unmount the filesystem
4. verify that the 'trimmed' flag is set in the checkpoint state

We should apply the commit ("f2fs: fix missing discard for active
segments") to resolve the issue where the 'trimmed' flag is missing.

Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
---
v3:
  - change the Copyright to VIVO
  - add this case to the "trim" test group
  - no need to check pwrite, as it is always present
v2:
  - Skip this test case if discard is not supported.
  - Renumber this test case from 012 to 014.
v1:
  https://lore.kernel.org/linux-f2fs-devel/20250521064952.1373690-1-guochunhai@vivo.com/
---
 tests/f2fs/014     | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/014.out |  2 ++
 2 files changed, 42 insertions(+)
 create mode 100755 tests/f2fs/014
 create mode 100644 tests/f2fs/014.out

diff --git a/tests/f2fs/014 b/tests/f2fs/014
new file mode 100755
index 000000000000..2f2e4dc360d9
--- /dev/null
+++ b/tests/f2fs/014
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 VIVO.  All Rights Reserved.
+#
+# FS QA Test No. f2fs/014
+#
+# This is a regression test case to verify whether the CP_TRIMMED_FLAG is
+# properly set after performing the following steps:
+# 1. mount the f2fs filesystem
+# 2. create a file, write data to it, then delete the file
+# 3. unmount the filesystem
+# 4. verify that the 'trimmed' flag is set in the checkpoint state
+# We should apply the commit ("f2fs: fix missing discard for active
+# segments") to resolve the issue where the 'trimmed' flag is missing.
+#
+. ./common/preamble
+_begin_fstest auto quick trim
+
+_fixed_by_kernel_commit 21263d035ff2 \
+	"f2fs: fix missing discard for active segments"
+
+_require_scratch
+_require_command "$DUMP_F2FS_PROG" dump.f2fs
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+_require_batched_discard $SCRATCH_MNT
+
+foo=$SCRATCH_MNT/foo
+$XFS_IO_PROG -c "pwrite 0 1m" -c "fsync" -f $foo >> $seqres.full
+sync
+
+rm $foo
+_scratch_unmount >> $seqres.full 2>&1
+
+$DUMP_F2FS_PROG $SCRATCH_DEV | grep "checkpoint state" | grep -o trimmed
+
+status=0
+exit
diff --git a/tests/f2fs/014.out b/tests/f2fs/014.out
new file mode 100644
index 000000000000..cb0c9447d675
--- /dev/null
+++ b/tests/f2fs/014.out
@@ -0,0 +1,2 @@
+QA output created by 014
+trimmed
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-05 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26  8:03 [PATCH v3] f2fs/014: test for missing 'trimmed' flag issue Chunhai Guo
2025-05-26  8:03 ` [f2fs-dev] " Chunhai Guo via Linux-f2fs-devel
2025-05-29  3:00 ` Chao Yu
2025-05-29  3:00   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-06-05 16:34 ` Zorro Lang
2025-06-05 16:34   ` [f2fs-dev] " Zorro Lang via Linux-f2fs-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.