Check that two parallel buffered sequential writers are separated into different zones when writeback happens before closing the files. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- tests/xfs/4208 | 79 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/4208.out | 3 ++ 2 files changed, 82 insertions(+) create mode 100755 tests/xfs/4208 create mode 100644 tests/xfs/4208.out diff --git a/tests/xfs/4208 b/tests/xfs/4208 new file mode 100755 index 000000000000..b85105704b65 --- /dev/null +++ b/tests/xfs/4208 @@ -0,0 +1,79 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Christoph Hellwig. +# +# FS QA Test No. 4208 +# +# Test that multiple buffered I/O write streams are directed to separate zones +# when written back with the file still open. +# +. ./common/preamble +_begin_fstest quick auto rw zone + +_cleanup() +{ + cd / + _scratch_unmount >/dev/null 2>&1 +} + +# Import common functions. +. ./common/filter + +_require_scratch + +_filter_rgno() +{ + # the rg number is in column 4 of xfs_bmap output + perl -ne ' + $rg = (split /\s+/)[4] ; + if ($rg =~ /\d+/) {print "$rg "} ; + ' +} + +_scratch_mkfs_xfs >>$seqres.full 2>&1 +_scratch_mount +_require_xfs_scratch_zoned 3 + +fio_config=$tmp.fio +fio_out=$tmp.fio.out +fio_err=$tmp.fio.err + +cat >$fio_config <<EOF +[global] +bs=64k +iodepth=16 +iodepth_batch=8 +size=1m +directory=$SCRATCH_MNT +rw=write +fsync_on_close=1 + +[file1] +filename=file1 +size=128m + +[file2] +filename=file2 +size=128m +EOF + +_require_fio $fio_config + +$FIO_PROG $fio_config --output=$fio_out +cat $fio_out >> $seqres.full + +# Check the files only have a single extent each and are in separate zones +extents1=$(_count_extents $SCRATCH_MNT/file1) +extents2=$(_count_extents $SCRATCH_MNT/file2) + +echo "number of file 1 extents: $extents1" +echo "number of file 2 extents: $extents2" + +rg1=`xfs_bmap -v $SCRATCH_MNT/file1 | _filter_rgno` +rg2=`xfs_bmap -v $SCRATCH_MNT/file2 | _filter_rgno` +if [ "${rg1}" == "${rg2}" ]; then + echo "same RG used for both files" +fi + +status=0 +exit diff --git a/tests/xfs/4208.out b/tests/xfs/4208.out new file mode 100644 index 000000000000..1aaea308fe6a --- /dev/null +++ b/tests/xfs/4208.out @@ -0,0 +1,3 @@ +QA output created by 4208 +number of file 1 extents: 1 +number of file 2 extents: 1 -- 2.47.2