[PATCH 3/3] xfs: add a test that mkfs round up realtime subvolume sizes to the zone size

Christoph Hellwig
2025-12-15T09:50:54Z

Make sure mkfs doesn't create unmountable file systems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/653 | 33 +++++++++++++++++++++++++++++++++
tests/xfs/653.out | 2 ++
2 files changed, 35 insertions(+)
create mode 100755 tests/xfs/653
create mode 100644 tests/xfs/653.out

diff --git a/tests/xfs/653 b/tests/xfs/653
new file mode 100755
index 000000000000..07d9125c2ff0
--- /dev/null
+++ b/tests/xfs/653
@@ -0,0 +1,33 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2025 Christoph Hellwig.
+#
+# FS QA Test No. 653
+#
+# Tests that mkfs for a zoned file system rounds realtime subvolume sizes up to
+# the zone size to create mountable file systems.
+#
+. ./common/preamble
+_begin_fstest auto quick realtime growfs zone
+
+. ./common/filter
+. ./common/zoned
+
+_require_realtime
+_require_scratch
+_require_scratch_size $((2 * 1024 * 1024)) # 1GiB in kiB units
+
+fsbsize=4096
+unaligned_size=$((((1 * 1024 * 1024 * 1024) + (fsbsize * 13)) / fsbsize))
+
+# Manual mkfs and mount to not inject an existing RT device
+echo "Try to format file system"
+_try_mkfs_dev -b size=4k -r zoned=1,size=${unaligned_size}b $SCRATCH_DEV \
+ >> $seqres.full 2>&1 ||\
+ _notrun "cannot mkfs zoned filesystem"
+_mount $SCRATCH_DEV $SCRATCH_MNT
+umount $SCRATCH_MNT
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/653.out b/tests/xfs/653.out
new file mode 100644
index 000000000000..2cba5cdf1171
--- /dev/null
+++ b/tests/xfs/653.out
@@ -0,0 +1,2 @@
+QA output created by 653
+Try to format file system
--
2.47.3