* [f2fs-dev] [PATCH] f2fs/012: test for missing 'trimmed' flag issue
@ 2025-05-21 6:49 Chunhai Guo via Linux-f2fs-devel
2025-05-21 8:04 ` Chao Yu via Linux-f2fs-devel
0 siblings, 1 reply; 2+ messages in thread
From: Chunhai Guo via Linux-f2fs-devel @ 2025-05-21 6:49 UTC (permalink / raw)
To: zlang, fstests; +Cc: jaegeuk, Chunhai Guo, linux-f2fs-devel
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>
---
tests/f2fs/012 | 39 +++++++++++++++++++++++++++++++++++++++
tests/f2fs/012.out | 2 ++
2 files changed, 41 insertions(+)
create mode 100755 tests/f2fs/012
create mode 100644 tests/f2fs/012.out
diff --git a/tests/f2fs/012 b/tests/f2fs/012
new file mode 100755
index 000000000000..b3486b730fd4
--- /dev/null
+++ b/tests/f2fs/012
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Guo Chunhai. All Rights Reserved.
+#
+# FS QA Test No. f2fs/012
+#
+# 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
+
+_fixed_by_kernel_commit 21263d035ff2 \
+ "f2fs: fix missing discard for active segments"
+
+_require_scratch
+_require_xfs_io_command "pwrite"
+_require_command "$DUMP_F2FS_PROG" dump.f2fs
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+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/012.out b/tests/f2fs/012.out
new file mode 100644
index 000000000000..00a061bb0ae4
--- /dev/null
+++ b/tests/f2fs/012.out
@@ -0,0 +1,2 @@
+QA output created by 012
+trimmed
--
2.34.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs/012: test for missing 'trimmed' flag issue
2025-05-21 6:49 [f2fs-dev] [PATCH] f2fs/012: test for missing 'trimmed' flag issue Chunhai Guo via Linux-f2fs-devel
@ 2025-05-21 8:04 ` Chao Yu via Linux-f2fs-devel
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-05-21 8:04 UTC (permalink / raw)
To: Chunhai Guo, zlang, fstests; +Cc: jaegeuk, linux-f2fs-devel
On 5/21/25 14:49, Chunhai Guo wrote:
> 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.
Chunhai, thanks for working on this testcase!
>
> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Also, as I tested, it works as expected.
Thanks,
> ---
> tests/f2fs/012 | 39 +++++++++++++++++++++++++++++++++++++++
> tests/f2fs/012.out | 2 ++
> 2 files changed, 41 insertions(+)
> create mode 100755 tests/f2fs/012
> create mode 100644 tests/f2fs/012.out
>
> diff --git a/tests/f2fs/012 b/tests/f2fs/012
> new file mode 100755
> index 000000000000..b3486b730fd4
> --- /dev/null
> +++ b/tests/f2fs/012
> @@ -0,0 +1,39 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2025 Guo Chunhai. All Rights Reserved.
> +#
> +# FS QA Test No. f2fs/012
> +#
> +# 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
> +
> +_fixed_by_kernel_commit 21263d035ff2 \
> + "f2fs: fix missing discard for active segments"
> +
> +_require_scratch
> +_require_xfs_io_command "pwrite"
> +_require_command "$DUMP_F2FS_PROG" dump.f2fs
> +
> +_scratch_mkfs >> $seqres.full
> +_scratch_mount >> $seqres.full
> +
> +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/012.out b/tests/f2fs/012.out
> new file mode 100644
> index 000000000000..00a061bb0ae4
> --- /dev/null
> +++ b/tests/f2fs/012.out
> @@ -0,0 +1,2 @@
> +QA output created by 012
> +trimmed
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-21 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 6:49 [f2fs-dev] [PATCH] f2fs/012: test for missing 'trimmed' flag issue Chunhai Guo via Linux-f2fs-devel
2025-05-21 8:04 ` Chao Yu via Linux-f2fs-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).