]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: add test to check for block layer reordering
authorChristoph Hellwig <hch@lst.de>
Thu, 8 May 2025 05:34:34 +0000 (07:34 +0200)
committerZorro Lang <zlang@kernel.org>
Thu, 8 May 2025 19:17:17 +0000 (03:17 +0800)
Zoned writes using zone append can be easily fragmented when the block
layer or the driver reorders I/O.  Check that a simple sequential
direct write creates a single extent.  This was broken in the kernel
until recently when using the ->commit_rqs interface on devices with
a relatively small max_hw_sectors / max_zone_append_sectors.

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

diff --git a/tests/xfs/636 b/tests/xfs/636
new file mode 100755 (executable)
index 0000000..872da41
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Christoph Hellwig
+#
+# FS QA Test No. 636
+#
+# Ensure that direct I/O writes are not pointlessly reordered on zoned
+# devices.
+#
+# This is a regression test for the block layer or drivers reordering
+# writes and thus creating more extents than required.
+#
+. ./common/preamble
+_begin_fstest quick auto rw zone
+
+. ./common/filter
+. ./common/zoned
+
+_require_scratch
+_require_realtime
+
+_scratch_mkfs >/dev/null 2>&1
+
+_scratch_mount
+_require_xfs_scratch_zoned
+_xfs_force_bdev realtime $SCRATCH_MNT
+
+dd if=/dev/zero of=$SCRATCH_MNT/test bs=1M count=16 oflag=direct
+
+echo "Check extent counts"
+extents=$(_count_extents $SCRATCH_MNT/test)
+
+# There should not be more than a single extent when there are
+# no other concurrent writers
+echo "number of extents: $extents"
+
+status=0
diff --git a/tests/xfs/636.out b/tests/xfs/636.out
new file mode 100644 (file)
index 0000000..e132f41
--- /dev/null
@@ -0,0 +1,5 @@
+QA output created by 636
+16+0 records in
+16+0 records out
+Check extent counts
+number of extents: 1