From: Christoph Hellwig <hch@lst.de>
To: zlang@kernel.org
Cc: djwong@kernel.org, dlemoal@kernel.org, hans.holmberg@wdc.com,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH v2] xfs: add a test for number of open zones on conventional devices
Date: Tue, 31 Mar 2026 17:23:20 +0200 [thread overview]
Message-ID: <20260331152341.4047725-1-hch@lst.de> (raw)
Test that mounts of zoned file systems on conventional devices don't
create more open zones than allowed when the last blocks in one or more
zones have been invalidated.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
- delete odd files
- fix the sysfs attr check to be on the scratch and not the test fs
tests/xfs/4201 | 66 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/4201.out | 1 +
2 files changed, 67 insertions(+)
create mode 100755 tests/xfs/4201
create mode 100644 tests/xfs/4201.out
diff --git a/tests/xfs/4201 b/tests/xfs/4201
new file mode 100755
index 000000000000..150978a9deda
--- /dev/null
+++ b/tests/xfs/4201
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Christoph Hellwig.
+#
+# FS QA Test No. 4201
+#
+# Test that mounts of zoned file systems on conventional devices don't create
+# more open zones than allowed when the last blocks in one or more zones have
+# been invalidated.
+#
+
+. ./common/preamble
+_begin_fstest auto quick zone
+
+_require_scratch
+_require_odirect
+_require_non_zoned_device $SCRATCH_DEV
+_require_non_zoned_device $SCRATCH_RTDEV
+
+open_zones=5
+blocks=65536
+bsize=4096
+
+zone_size_mib=$((blocks * bsize / 1024 / 1024))
+file_size_mib=$((zone_size_mib / 2))
+nr_files=$((open_zones * 3 - 1))
+
+echo "zone size: $zone_size_mib" >>$seqres.full
+echo "file size: $file_size_mib" >>$seqres.full
+echo "nr files: $nr_files" >>$seqres.full
+
+_scratch_mkfs -b size=${bsize} -r zoned=1,rgsize=${blocks}b \
+ > "$seqres.full" 2>&1
+_scratch_mount -o max_open_zones=${open_zones}
+
+_has_fs_sysfs_attr $SCRATCH_DEV zoned/nr_open_zones || \
+ _notrun "This test requires /sys/fs/${FSTYP}/$SCRATCH_DEV/zoned/nr_open_zones"
+
+for i in $(seq 1 $nr_files); do
+ dd if=/dev/zero of=$SCRATCH_MNT/$i bs=1M count=$file_size_mib \
+ oflag=direct > /dev/null 2>&1
+done
+
+# delete odd numbered files as they should be at the end of the zones
+for ((i = 0; i < $nr_files; i = $((i + 2)))); do
+ rm $SCRATCH_MNT/$((i + 1))
+done
+
+_scratch_unmount
+_scratch_mount -o max_open_zones=${open_zones}
+
+max_open=$(_get_fs_sysfs_attr $SCRATCH_DEV zoned/max_open_zones)
+nr_open=$(_get_fs_sysfs_attr $SCRATCH_DEV zoned/nr_open_zones)
+
+if [ ${max_open} -ne $((open_zones - 1)) ]; then
+ _fail "Test needs adjustments for multiple open GC zones"
+fi
+
+if [ ${nr_open} -gt ${max_open} ]; then
+ _fail "Too many open zones: $nr_open/$max_open"
+fi
+
+_scratch_unmount
+
+status=0
+exit
diff --git a/tests/xfs/4201.out b/tests/xfs/4201.out
new file mode 100644
index 000000000000..32e395dd4d6d
--- /dev/null
+++ b/tests/xfs/4201.out
@@ -0,0 +1 @@
+QA output created by 4201
--
2.47.3
next reply other threads:[~2026-03-31 15:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 15:23 Christoph Hellwig [this message]
2026-03-31 19:40 ` [PATCH v2] xfs: add a test for number of open zones on conventional devices Damien Le Moal
2026-03-31 21:18 ` Zorro Lang
2026-04-01 6:18 ` Christoph Hellwig
2026-04-01 7:59 ` Zorro Lang
2026-04-01 14:06 ` Christoph Hellwig
2026-04-06 17:05 ` Zorro Lang
2026-04-07 6:27 ` Christoph Hellwig
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=20260331152341.4047725-1-hch@lst.de \
--to=hch@lst.de \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hans.holmberg@wdc.com \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@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