From: Christoph Hellwig Date: Thu, 8 May 2025 05:34:34 +0000 (+0200) Subject: xfs: add test to check for block layer reordering X-Git-Tag: v2025.05.11~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=66f5b97a09fbb49bf27846dd3e0431e1b081ca66;p=xfstests-dev.git xfs: add test to check for block layer reordering 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 Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/tests/xfs/636 b/tests/xfs/636 new file mode 100755 index 00000000..872da416 --- /dev/null +++ b/tests/xfs/636 @@ -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 index 00000000..e132f415 --- /dev/null +++ b/tests/xfs/636.out @@ -0,0 +1,5 @@ +QA output created by 636 +16+0 records in +16+0 records out +Check extent counts +number of extents: 1