]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: test that mkfs creates zone-aligned RT devices
authorChristoph Hellwig <hch@lst.de>
Fri, 19 Dec 2025 05:35:46 +0000 (06:35 +0100)
committerZorro Lang <zlang@kernel.org>
Wed, 31 Dec 2025 20:59:50 +0000 (04:59 +0800)
Make sure mkfs doesn't create unmountable file systems and instead rounds
down the RT subvolume size to a multiple of the zone size.

Two passes: one with a device that is not aligned, and one for an
explicitly specified unaligned RT device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/xfs/653 [new file with mode: 0755]
tests/xfs/653.out [new file with mode: 0644]

diff --git a/tests/xfs/653 b/tests/xfs/653
new file mode 100755 (executable)
index 0000000..12d606c
--- /dev/null
@@ -0,0 +1,66 @@
+#! /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
+
+_cleanup()
+{
+       _unmount $LOOP_MNT 2>/dev/null
+       [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
+       rm -rf $LOOP_IMG $LOOP_MNT
+       cd /
+       rm -f $tmp.*
+}
+
+_require_test
+_require_loop
+_require_xfs_io_command "truncate"
+
+fsbsize=4096
+aligned_size=$((3 * 1024 * 1024 * 1024))
+unaligned_size=$((2 * 1024 * 1024 * 1024 + fsbsize * 13))
+
+_require_fs_space $TEST_DIR $((aligned_size / 1024))
+
+LOOP_IMG=$TEST_DIR/$seq.dev
+LOOP_MNT=$TEST_DIR/$seq.mnt
+rm -rf $LOOP_IMG $LOOP_MNT
+mkdir -p $LOOP_MNT
+
+# try to create an unaligned RT volume by manually specifying the RT device size
+$XFS_IO_PROG -f -c "truncate ${aligned_size}" $LOOP_IMG
+loop_dev=$(_create_loop_device $LOOP_IMG)
+
+echo "Formatting file system (unaligned specified size)"
+_try_mkfs_dev -b size=4k -r zoned=1,size=$((unaligned_size / fsbsize))b $loop_dev \
+               >> $seqres.full 2>&1 ||\
+       _notrun "cannot mkfs zoned filesystem"
+_mount $loop_dev $LOOP_MNT
+umount $LOOP_MNT
+_destroy_loop_device $loop_dev
+rm -rf $LOOP_IMG
+
+# try to create an unaligned RT volume on on an oddly sized device
+$XFS_IO_PROG -f -c "truncate ${unaligned_size}" $LOOP_IMG
+loop_dev=$(_create_loop_device $LOOP_IMG)
+
+echo "Formatting file system (unaligned device)"
+_try_mkfs_dev -b size=4k -r zoned=1 $loop_dev \
+               >> $seqres.full 2>&1 ||\
+       _notrun "cannot mkfs zoned filesystem"
+_mount $loop_dev $LOOP_MNT
+umount $LOOP_MNT
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/653.out b/tests/xfs/653.out
new file mode 100644 (file)
index 0000000..96158d9
--- /dev/null
@@ -0,0 +1,3 @@
+QA output created by 653
+Formatting file system (unaligned specified size)
+Formatting file system (unaligned device)