[PATCH 03/15] xfs: add test to check for block layer reordering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 tests/xfs/4203     | 37 +++++++++++++++++++++++++++++++++++++
 tests/xfs/4203.out |  5 +++++
 2 files changed, 42 insertions(+)
 create mode 100755 tests/xfs/4203
 create mode 100644 tests/xfs/4203.out

diff --git a/tests/xfs/4203 b/tests/xfs/4203
new file mode 100755
index 000000000000..9f0280c26fc8
--- /dev/null
+++ b/tests/xfs/4203
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Christoph Hellwig
+#
+# FS QA Test No. 4203
+#
+# 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/4203.out b/tests/xfs/4203.out
new file mode 100644
index 000000000000..f5aaece908fa
--- /dev/null
+++ b/tests/xfs/4203.out
@@ -0,0 +1,5 @@
+QA output created by 4203
+16+0 records in
+16+0 records out
+Check extent counts
+number of extents: 1
-- 
2.47.2





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux