From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Zorro Lang <zlang@kernel.org>,
fstests@vger.kernel.org,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Kanchan Joshi <joshi.k@samsung.com>,
Anuj Gupta <anuj20.g@samsung.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH 4/5] generic: test I/O on devices with T10 protection information
Date: Fri, 21 Aug 2026 16:37:49 -0700 [thread overview]
Message-ID: <20260821233749.GG839663@frogsfrogsfrogs> (raw)
In-Reply-To: <20260821051133.1817670-5-hch@lst.de>
On Fri, Aug 21, 2026 at 07:11:29AM +0200, Christoph Hellwig wrote:
> Add a test that runs fsx in buffered and direct I/O mode on T10 PI
> type 1, 2, 3 with and without strip/insert using scsi_debug.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/generic/2301 | 91 ++++++++++++++++++++++++++++++++++++++++++
> tests/generic/2301.out | 73 +++++++++++++++++++++++++++++++++
> 2 files changed, 164 insertions(+)
> create mode 100755 tests/generic/2301
> create mode 100644 tests/generic/2301.out
>
> diff --git a/tests/generic/2301 b/tests/generic/2301
> new file mode 100755
> index 000000000000..ba6952855f55
> --- /dev/null
> +++ b/tests/generic/2301
> @@ -0,0 +1,91 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 Christoph Hellwig
> +#
> +# FS QA Test No. 2301
> +#
> +# Basix FSX sanity check when using T10 protection information
> +#
> +. ./common/preamble
> +_begin_fstest auto rw pi dangerous
Why dangerous? Can this crash the system?
> +
> +_cleanup()
> +{
> + cd /
> + rm -r -f $tmp.*
> + [ -d "$SCSI_DEBUG_MNT" ] && _unmount $SCSI_DEBUG_MNT 2>/dev/null
> + _put_scsi_debug_dev
> +}
> +
> +. ./common/scsi_debug
> +
> +_require_debugfs
> +_require_scsi_debug
> +# If TEST_DEV is block device, make sure current fs is a localfs which can be
> +# written on scsi_debug device
> +_require_test
> +_require_block_device $TEST_DEV
> +_require_odirect
> +
> +size=$(_small_fs_size_mb 256)
> +
> +# like run_fsx(), but using a custom path
> +fsx_run()
> +{
> + _run_fsx_on_file $SCSI_DEBUG_MNT/junk $@ || _exit 1
> +}
> +
> +test_dif()
> +{
> + local pi_type=$1
> + local pi_enable="$2"
> +
> + scsi_debug_pi_opts="write_same_length=0 dif=${pi_type} dix=1"
> + SCSI_DEBUG_DEV=`_get_scsi_debug_dev 512 512 0 $size $scsi_debug_pi_opts`
> +
> + SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq"
> + rm -rf $SCSI_DEBUG_MNT
> + mkdir $SCSI_DEBUG_MNT
> +
> + _mkfs_dev $SCSI_DEBUG_DEV || \
> + _fail "Can't make $FSTYP on DIF-enabled scsi_debug device"
I wonder, wouldn't it help to broaden feature testing coverage if we
could inject the scratch device's mkfs/mount options here? With just a
bare _mkfs_dev you only test the mkfs defaults. For example, you won't
be testing xfs with metadir and t10 until mkfs.xfs turns that on by
default.
That said, the big problem with that is that there's only one scsi-debug
device and multi-device scratch fs options won't work with that. I'm
not ride-or-die for this, but I thought it was worth mentioning.
--D
> + run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT
> + bsize=$($here/src/min_dio_alignment $SCSI_DEBUG_MNT $SCSI_DEBUG_DEV)
> +
> + local integrity_path="$(_sysfs_block_integrity_path $SCSI_DEBUG_DEV)"
> + echo $pi_enable > $integrity_path/read_verify
> + echo $pi_enable > $integrity_path/write_generate
> +
> + # fsx load similar to generic/091
> + echo "Testing direct I/O for DIF type $pi_type (enabled: $pi_enable)"
> + local dio_opts="-r PSIZE -t BSIZE -w BSIZE"
> + fsx_run -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> + fsx_run -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> + fsx_run -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> + fsx_run -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> + fsx_run -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> + fsx_run -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +
> + # fsx load similar to generic/091 but using buffered I/O
> + echo "Testing buffered I/O for DIF type $pi_type (enabled: $pi_enable)"
> + fsx_run -N 10000 -l 500000
> + fsx_run -N 10000 -o 8192 -l 500000
> + fsx_run -N 10000 -o 32768 -l 500000
> + fsx_run -N 10000 -o 128000 -l 500000
> +
> + [ -d "$SCSI_DEBUG_MNT" ] && _unmount $SCSI_DEBUG_MNT 2>/dev/null
> + _put_scsi_debug_dev
> +}
> +
> +# Test with PI fully enabled
> +test_dif 1 1
> +test_dif 2 1
> +test_dif 3 1
> +
> +# Test with strip / insert in the HBA
> +test_dif 1 0
> +test_dif 2 0
> +test_dif 3 0
> +
> +# success, all done
> +_exit 0
> diff --git a/tests/generic/2301.out b/tests/generic/2301.out
> new file mode 100644
> index 000000000000..dda88676a219
> --- /dev/null
> +++ b/tests/generic/2301.out
> @@ -0,0 +1,73 @@
> +QA output created by 2301
> +Testing direct I/O for DIF type 1 (enabled: 1)
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O for DIF type 1 (enabled: 1)
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> +Testing direct I/O for DIF type 2 (enabled: 1)
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O for DIF type 2 (enabled: 1)
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> +Testing direct I/O for DIF type 3 (enabled: 1)
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O for DIF type 3 (enabled: 1)
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> +Testing direct I/O for DIF type 1 (enabled: 0)
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O for DIF type 1 (enabled: 0)
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> +Testing direct I/O for DIF type 2 (enabled: 0)
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O for DIF type 2 (enabled: 0)
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> +Testing direct I/O for DIF type 3 (enabled: 0)
> +fsx -N 10000 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 8192 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 32768 -l 500000 -r BSIZE -w BSIZE -Z -R -W
> +fsx -N 10000 -o 128000 -l 500000 -r BSIZE -w BSIZE -Z -W
> +Testing buffered I/O for DIF type 3 (enabled: 0)
> +fsx -N 10000 -l 500000
> +fsx -N 10000 -o 8192 -l 500000
> +fsx -N 10000 -o 32768 -l 500000
> +fsx -N 10000 -o 128000 -l 500000
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-08-21 23:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 5:11 add tests for file system on devices using protection information v2 Christoph Hellwig
2026-08-21 5:11 ` [PATCH 1/5] common/scsi_debug: don't slow down I/O Christoph Hellwig
2026-08-21 7:41 ` John Garry
2026-08-21 16:14 ` Bart Van Assche
2026-08-21 23:27 ` Darrick J. Wong
2026-08-21 5:11 ` [PATCH 2/5] common: add a _sysfs_block_integrity_path helper Christoph Hellwig
2026-08-21 23:29 ` Darrick J. Wong
2026-08-21 5:11 ` [PATCH 3/5] add a "pi" group Christoph Hellwig
2026-08-21 23:30 ` Darrick J. Wong
2026-08-21 5:11 ` [PATCH 4/5] generic: test I/O on devices with T10 protection information Christoph Hellwig
2026-08-21 23:37 ` Darrick J. Wong [this message]
2026-08-21 5:11 ` [PATCH 5/5] generic: test corruption detection using " Christoph Hellwig
2026-08-21 23:38 ` Darrick J. Wong
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=20260821233749.GG839663@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=anuj20.g@samsung.com \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--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