From: Christoph Hellwig <hch@lst.de>
To: Zorro Lang <zlang@kernel.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
Hans Holmberg <hans.holmberg@wdc.com>,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH 07/15] xfs: add a test for write lifetime hints
Date: Wed, 7 May 2025 07:12:27 +0200 [thread overview]
Message-ID: <20250507051249.3898395-8-hch@lst.de> (raw)
In-Reply-To: <20250507051249.3898395-1-hch@lst.de>
Test that the zone allocator actually places by temperature bucket.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/xfs/4205 | 90 ++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/4205.out | 4 +++
2 files changed, 94 insertions(+)
create mode 100755 tests/xfs/4205
create mode 100644 tests/xfs/4205.out
diff --git a/tests/xfs/4205 b/tests/xfs/4205
new file mode 100755
index 000000000000..c37f5f5cc324
--- /dev/null
+++ b/tests/xfs/4205
@@ -0,0 +1,90 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Christoph Hellwig.
+#
+# FS QA Test No. 4205
+#
+# Test data placement by write hints.
+#
+. ./common/preamble
+_begin_fstest auto rw zone
+
+. ./common/filter
+. ./common/xfs
+
+_require_scratch
+
+test_placement()
+{
+ xfs_io_opts=$1
+
+ _scratch_mkfs_xfs >>$seqres.full 2>&1
+ _scratch_mount
+ _require_xfs_scratch_zoned 3
+
+ # Create a bunch of files for the three major temperature buckets
+ for i in `seq 1 100`; do
+ for hint in "short" "medium" "long"; do
+ file=$SCRATCH_MNT/$hint.$i
+
+ touch $file
+ $here/src/rw_hint $file $hint
+ $XFS_IO_PROG ${xfs_io_opts} \
+ -c 'pwrite 0 1m' \
+ $file >>$seqres.full
+ done
+ done
+
+ sync
+
+ # Check that all short lifetime files are placed together
+ short_rg=`xfs_bmap -v $SCRATCH_MNT/short.1 | _filter_rgno`
+ for i in `seq 2 100`; do
+ file=$SCRATCH_MNT/short.$i
+ rg=`xfs_bmap -v $file | _filter_rgno`
+ if [ "${rg}" != "${short_rg}" ]; then
+ echo "short RG mismatch for file $i: $short_rg/$rg"
+ fi
+ done
+
+ # Check that all medium lifetime files are placed together,
+ # but not in the short RG
+ medium_rg=`xfs_bmap -v $SCRATCH_MNT/medium.1 | _filter_rgno`
+ if [ "${medium}" == "${short_rg}" ]; then
+ echo "medium rg == short_rg"
+ fi
+ for i in `seq 2 100`; do
+ file=$SCRATCH_MNT/medium.$i
+ rg=`xfs_bmap -v $file | _filter_rgno`
+ if [ "${rg}" != "${medium_rg}" ]; then
+ echo "medium RG mismatch for file $i: $medium_rg/$rg"
+ fi
+ done
+
+ # Check that none of the long lifetime files are colocated with
+ # short and medium ones
+ for i in `seq 1 100`; do
+ file=$SCRATCH_MNT/long.$i
+ rg=`xfs_bmap -v $file | _filter_rgno`
+ if [ "${rg}" == "${short_rg}" ]; then
+ echo "long file $i placed into short RG "
+ fi
+ if [ "${rg}" == "${medium_rg}" ]; then
+ echo "long file $i placed into medium RG"
+ fi
+ done
+
+ _scratch_unmount
+}
+
+echo "Testing buffered I/O:"
+test_placement ""
+
+echo "Testing synchronous buffered I/O:"
+test_placement "-s"
+
+echo "Testing direct I/O:"
+test_placement "-d"
+
+status=0
+exit
diff --git a/tests/xfs/4205.out b/tests/xfs/4205.out
new file mode 100644
index 000000000000..3331e361a36d
--- /dev/null
+++ b/tests/xfs/4205.out
@@ -0,0 +1,4 @@
+QA output created by 4205
+Testing buffered I/O:
+Testing synchronous buffered I/O:
+Testing direct I/O:
--
2.47.2
next prev parent reply other threads:[~2025-05-07 5:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 5:12 new tests for zoned xfs v2 Christoph Hellwig
2025-05-07 5:12 ` [PATCH 01/15] common: add a _filter_rgno helper Christoph Hellwig
2025-05-07 21:06 ` Darrick J. Wong
2025-05-07 5:12 ` [PATCH 02/15] add a new rw_hint helper Christoph Hellwig
2025-05-07 5:12 ` [PATCH 03/15] xfs: add a test for zoned block accounting after remount Christoph Hellwig
2025-05-07 5:12 ` [PATCH 04/15] xfs: add a zoned growfs test Christoph Hellwig
2025-05-07 5:12 ` [PATCH 05/15] xfs: add test to check for block layer reordering Christoph Hellwig
2025-05-07 5:12 ` [PATCH 06/15] xfs: add a test to check that data growfs fails with internal rt device Christoph Hellwig
2025-05-07 5:12 ` Christoph Hellwig [this message]
2025-05-07 5:12 ` [PATCH 08/15] xfs: add a test for writeback after close Christoph Hellwig
2025-05-07 5:12 ` [PATCH 09/15] xfs: test zone stream separation for two direct writers Christoph Hellwig
2025-05-07 5:12 ` [PATCH 10/15] xfs: test zone stream separation for two buffered writers Christoph Hellwig
2025-05-07 5:12 ` [PATCH 11/15] xfs: test zoned ENOSPC behavior with multiple writers Christoph Hellwig
2025-05-07 5:12 ` [PATCH 12/15] xfs: test zoned GC file defragmentation for sequential writers Christoph Hellwig
2025-05-07 5:12 ` [PATCH 13/15] xfs: test zoned GC file defragmentation for random writers Christoph Hellwig
2025-05-07 5:12 ` [PATCH 14/15] xfs: test that xfs_repair does not mess up the zone used counter Christoph Hellwig
2025-05-07 5:12 ` [PATCH 15/15] xfs: test that truncate does not spuriously return ENOSPC Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250507051249.3898395-8-hch@lst.de \
--to=hch@lst.de \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hans.holmberg@wdc.com \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).