FSTests Archive mirror
 help / color / mirror / Atom feed
From: Suraj Jitindar Singh <surajjs@amazon.com>
To: <fstests@vger.kernel.org>
Cc: <surajjs@amazon.com>, <sjitindarsingh@gmail.com>
Subject: [PATCH] ext4/060: Test marking last group as trimmed
Date: Wed, 28 Feb 2024 13:16:12 -0800	[thread overview]
Message-ID: <20240228211612.2602355-1-surajjs@amazon.com> (raw)

Regression test for upstream commit added in v6.8-rc1:
7c784d624819a ext4: allow for the last group to be marked as trimmed

Which fixes bug introduced by upstream commit in v6.6-rc2:
45e4ab320c9b5 ext4: move setting of trimmed bit into ext4_try_to_trim_range()

Applicable to kernels 4.19..6.7:
Kernel		Bug Introduced			Bug Fixed
		kver      - commit sha		kver      - commit sha
4.19		v4.19.296 - d61445f6a5c57	v4.19.307 - 5b6a7f323b533
5.4		v5.4.258  - 4db34feaf2977	v5.4.269  - a7edaf40fccae
5.10		v5.10.198 - c502b09d9befc	v5.10.210 - fa94912241835
5.15		v5.15.134 - a9d3bb58da959	v5.15.149 - cb904f5c71629
6.1		v6.1.56   - b4d5db1c77fac	v6.1.76   - 852b6b2a2f7b7
6.6		v6.6-rc2  - 45e4ab320c9b5	v6.6.15   - da9008da96404
6.7		v6.6-rc2  - 45e4ab320c9b5	v6.7.3    - 73986e8d2808c

Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
---
 tests/ext4/060     | 62 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/060.out |  2 ++
 2 files changed, 64 insertions(+)
 create mode 100755 tests/ext4/060
 create mode 100644 tests/ext4/060.out

diff --git a/tests/ext4/060 b/tests/ext4/060
new file mode 100755
index 00000000..cc5f3819
--- /dev/null
+++ b/tests/ext4/060
@@ -0,0 +1,62 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# FS QA Test No. 309
+#
+# Regression test for upstream commit added in v6.8-rc1:
+# 7c784d624819a ext4: allow for the last group to be marked as trimmed
+#
+# Which fixes bug introduced by upstream commit in v6.6-rc2:
+# 45e4ab320c9b5 ext4: move setting of trimmed bit into ext4_try_to_trim_range()
+#
+# Applicable to kernels 4.19..6.7:
+# Kernel	Bug Introduced			Bug Fixed
+#		kver      - commit sha		kver      - commit sha
+# 4.19		v4.19.296 - d61445f6a5c57	v4.19.307 - 5b6a7f323b533
+# 5.4		v5.4.258  - 4db34feaf2977	v5.4.269  - a7edaf40fccae
+# 5.10		v5.10.198 - c502b09d9befc	v5.10.210 - fa94912241835
+# 5.15		v5.15.134 - a9d3bb58da959	v5.15.149 - cb904f5c71629
+# 6.1		v6.1.56   - b4d5db1c77fac	v6.1.76   - 852b6b2a2f7b7
+# 6.6		v6.6-rc2  - 45e4ab320c9b5	v6.6.15   - da9008da96404
+# 6.7		v6.6-rc2  - 45e4ab320c9b5	v6.7.3    - 73986e8d2808c
+
+. ./common/preamble
+_begin_fstest auto
+
+# Override the default cleanup function.
+_cleanup()
+{
+    _scratch_unmount
+}
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs ext4
+
+_require_scratch
+_require_fstrim
+
+# Make an ext4 fs where the last group has fewer blocks than blocks per group
+blksz=$(_get_page_size)
+blocks_per_group=8192
+
+$MKFS_EXT4_PROG -F -b $blksz -g $blocks_per_group $SCRATCH_DEV $(( blocks_per_group - 1 )) >>$seqres.full 2>&1
+_scratch_mount
+
+$FSTRIM_PROG -v $SCRATCH_MNT >>$seqres.full 2>&1
+# If we have the fix commit then the above trim command should have marked the
+# group as trimmed and subsequent trim operations shouldn't discard anything.
+# If we don't have the fix commit then the group won't have been marked as
+# trimmed and the below trim operation will discard more than 0.
+bytes=$($FSTRIM_PROG -v $SCRATCH_MNT | tee -a $seqres.full | _filter_fstrim)
+if [ $bytes -gt 0 ]; then
+	status=1
+	echo "Final group in filesystem not marked as trimmed after trimming entire fs."
+else
+	status=0
+	echo "Final group in filesystem correctly marked as trimmed after trimming entire fs."
+fi
+
+exit
diff --git a/tests/ext4/060.out b/tests/ext4/060.out
new file mode 100644
index 00000000..f3457134
--- /dev/null
+++ b/tests/ext4/060.out
@@ -0,0 +1,2 @@
+QA output created by 060
+Final group in filesystem correctly marked as trimmed after trimming entire fs.
-- 
2.34.1


             reply	other threads:[~2024-02-28 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 21:16 Suraj Jitindar Singh [this message]
2024-02-29  1:38 ` [PATCH] ext4/060: Test marking last group as trimmed Zorro Lang

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=20240228211612.2602355-1-surajjs@amazon.com \
    --to=surajjs@amazon.com \
    --cc=fstests@vger.kernel.org \
    --cc=sjitindarsingh@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).