atomic writes tests (part 2)
v3 cover atomic writes tests (part 2)
Hi all,
This series contains the tests from patch 6 of the previous atomic writes test series.
https://lore.kernel.org/linux-xfs/[email protected]/
Relevant changes from v2->v3:
- add a new _require_scratch_write_atomic_multi_fsblock function
- split xfs tests into a separate patch
- split mixed mapping test into two separate tests (reflink and non-reflink)
- generic/1222: check that required xfs_io commands are present when using scsi_debug
- generic/1225: add more tests for unwritten and interweaved mappings
This series is based on for-next at the time of sending.
Catherine Hoang (3):
common/atomicwrites: add helper for multi block atomic writes
generic: various atomic write tests with scsi_debug
xfs: more multi-block atomic writes tests
common/atomicwrites | 31 ++++++++++ tests/generic/1222 | 89 ++++++++++++++++++++++++++++ tests/generic/1222.out | 10 ++++ tests/generic/1223 | 67 +++++++++++++++++++++ tests/generic/1223.out | 9 +++ tests/generic/1224 | 86 +++++++++++++++++++++++++++ tests/generic/1224.out | 16 ++++++ tests/generic/1225 | 128 +++++++++++++++++++++++++++++++++++++++++ tests/generic/1225.out | 21 +++++++ tests/xfs/1216 | 68 ++++++++++++++++++++++ tests/xfs/1216.out | 9 +++ tests/xfs/1217 | 71 +++++++++++++++++++++++ tests/xfs/1217.out | 3 + tests/xfs/1218 | 60 +++++++++++++++++++ tests/xfs/1218.out | 15 +++++ 15 files changed, 683 insertions(+) create mode 100755 tests/generic/1222 create mode 100644 tests/generic/1222.out create mode 100755 tests/generic/1223 create mode 100644 tests/generic/1223.out create mode 100755 tests/generic/1224 create mode 100644 tests/generic/1224.out create mode 100755 tests/generic/1225 create mode 100644 tests/generic/1225.out create mode 100755 tests/xfs/1216 create mode 100644 tests/xfs/1216.out create mode 100755 tests/xfs/1217 create mode 100644 tests/xfs/1217.out create mode 100755 tests/xfs/1218 create mode 100644 tests/xfs/1218.out
Signature · 1 line
2.34.1
PATCH v3 1/3 common/atomicwrites: add helper for multi block atomic writes
Add a helper to check that we can perform multi block atomic writes.
--- common/atomicwrites | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
common/atomicwrites +21 -0
@@ -24,6 +24,27 @@ _get_atomic_write_segments_max() grep -w atomic_write_segments_max | grep -o '[0-9]\+' } +_require_scratch_write_atomic_multi_fsblock() +{ + _require_scratch + + _scratch_mkfs > /dev/null 2>&1 || \ + _notrun "cannot format scratch device for atomic write checks" + _try_scratch_mount || \ + _notrun "cannot mount scratch device for atomic write checks" + + local testfile=$SCRATCH_MNT/testfile + touch $testfile + + local bsize=$(_get_file_block_size $SCRATCH_MNT) + local awu_max_fs=$(_get_atomic_write_unit_max $testfile) + + _scratch_unmount + + test $awu_max_fs -ge $((bsize * 2)) || \ + _notrun "multi-block atomic writes not supported by this filesystem" +} + _require_scratch_write_atomic() { _require_scratch
Signature · 1 line
2.34.1
Re: [PATCH v3 1/3] common/atomicwrites: add helper for multi block atomic writes
Quoted 1 line · Catherine Hoang
Add a helper to check that we can perform multi block atomic writes.
It would be nice to mention why we need this.
Quoted 2 lines
Signed-off-by Catherine Hoang<[email protected]>
Re: [PATCH v3 1/3] common/atomicwrites: add helper for multi block atomic writes
In reply to Catherine HoangQuoted 26 lines · Catherine Hoang
Add a helper to check that we can perform multi block atomic writes.
Signed-off-by Catherine Hoang <[email protected]>--- common/atomicwrites | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)common/atomicwrites +11
-0@@ -24,6 +24,27 @@ _get_atomic_write_segments_max() grep -w atomic_write_segments_max | grep -o '[0-9]\+' } +_require_scratch_write_atomic_multi_fsblock() +{ + _require_scratch + + _scratch_mkfs > /dev/null 2>&1 || \ + _notrun "cannot format scratch device for atomic write checks" + _try_scratch_mount || \ + _notrun "cannot mount scratch device for atomic write checks" + + local testfile=$SCRATCH_MNT/testfile + touch $testfile
common/atomicwrites _get_atomic_write_segments_max() · line 47
Quoted 10 lines
common/atomicwrites +10
-0+ + local bsize=$(_get_file_block_size $SCRATCH_MNT) + local awu_max_fs=$(_get_atomic_write_unit_max $testfile) + + _scratch_unmount + + test $awu_max_fs -ge $((bsize * 2)) || \ + _notrun "multi-block atomic writes not supported by this filesystem" +} +
Looks good. Please feel free to add:
-ritesh
PATCH v3 2/3 generic: various atomic write tests with scsi_debug
In reply to Catherine HoangSimple tests of various atomic write requests and a (simulated) hardware device.
--- common/atomicwrites | 10 ++++ tests/generic/1222 | 89 ++++++++++++++++++++++++++++ tests/generic/1222.out | 10 ++++ tests/generic/1223 | 67 +++++++++++++++++++++ tests/generic/1223.out | 9 +++ tests/generic/1224 | 86 +++++++++++++++++++++++++++ tests/generic/1224.out | 16 ++++++ tests/generic/1225 | 128 +++++++++++++++++++++++++++++++++++++++++ tests/generic/1225.out | 21 +++++++ 9 files changed, 436 insertions(+) create mode 100755 tests/generic/1222 create mode 100644 tests/generic/1222.out create mode 100755 tests/generic/1223 create mode 100644 tests/generic/1223.out create mode 100755 tests/generic/1224 create mode 100644 tests/generic/1224.out create mode 100755 tests/generic/1225 create mode 100644 tests/generic/1225.out
common/atomicwrites +10 -0
@@ -136,3 +136,13 @@ _test_atomic_file_writes() $XFS_IO_PROG -dc "pwrite -A -D -V1 -b $bsize 1 $bsize" $testfile 2>> $seqres.full && \ echo "atomic write requires offset to be aligned to bsize" } + +_simple_atomic_write() { + local pos=$1 + local count=$2 + local file=$3 + local directio=$4 + + echo "testing pos=$pos count=$count file=$file directio=$directio" >> $seqres.full + $XFS_IO_PROG $directio -c "pwrite -b $count -V 1 -A -D $pos $count" $file >> $seqres.full +}
tests/generic/1222 new file +89 -0
89 lines not on this page · raw message
tests/generic/1222.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1222 +two EINVAL for unsupported sizes +pwrite: Invalid argument +pwrite: Invalid argument +all should work +one EOPNOTSUPP for buffered atomic +pwrite: Operation not supported +one EINVAL for unaligned directio +pwrite: Invalid argument +Silence is golden
tests/generic/1223 new file +67 -0
67 lines not on this page · raw message
tests/generic/1223.out new file +9 -0
@@ -0,0 +1,9 @@ +QA output created by 1223 +two EINVAL for unsupported sizes +pwrite: Invalid argument +pwrite: Invalid argument +one EOPNOTSUPP for buffered atomic +pwrite: Operation not supported +one EINVAL for unaligned directio +pwrite: Invalid argument +Silence is golden
tests/generic/1224 new file +86 -0
86 lines not on this page · raw message
tests/generic/1224.out new file +16 -0
@@ -0,0 +1,16 @@ +QA output created by 1224 +atomic write shared data and unshared+shared data +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +f1c9645dbc14efddc7d8a322685f26eb SCRATCH_MNT/file2 +atomic write shared data and shared+unshared data +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +f1c9645dbc14efddc7d8a322685f26eb SCRATCH_MNT/file2 +atomic overwrite unshared data +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +f1c9645dbc14efddc7d8a322685f26eb SCRATCH_MNT/file2 +atomic write shared+unshared+shared data +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +f1c9645dbc14efddc7d8a322685f26eb SCRATCH_MNT/file2 +atomic write interweaved hole+unwritten+written+reflinked +4edfbc469bed9965219ea80c9ae54626 SCRATCH_MNT/file1 +93243a293a9f568903485b0b2a895815 SCRATCH_MNT/file2
tests/generic/1225 new file +128 -0
128 lines not on this page · raw message
tests/generic/1225.out new file +21 -0
@@ -0,0 +1,21 @@ +QA output created by 1225 +atomic write hole+mapped+hole +9464b66461bc1d20229e1b71733539d0 SCRATCH_MNT/file1 +atomic write adjacent mapped+hole and hole+mapped +9464b66461bc1d20229e1b71733539d0 SCRATCH_MNT/file1 +atomic write mapped+hole+mapped +9464b66461bc1d20229e1b71733539d0 SCRATCH_MNT/file1 +atomic write unwritten+mapped+unwritten +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +atomic write adjacent mapped+unwritten and unwritten+mapped +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +atomic write mapped+unwritten+mapped +111ce6bf29d5b1dbfb0e846c42719ece SCRATCH_MNT/file1 +atomic write interweaved hole+unwritten+written +5577e46f20631d76bbac73ab1b4ed208 SCRATCH_MNT/file1 +atomic write at EOF +75572c4929fde8faf131e84df4c6a764 SCRATCH_MNT/file1 +atomic write preallocated region +27a248351cd540bc9ac2c2dc841abca2 SCRATCH_MNT/file1 +atomic write max size on fragmented fs +27c9068d1b51da575a53ad34c57ca5cc SCRATCH_MNT/file3
Signature · 1 line
2.34.1
Re: [PATCH v3 2/3] generic: various atomic write tests with scsi_debug
Quoted 2 lines · Catherine Hoang
Simple tests of various atomic write requests and a (simulated) hardware device.
There's > 400 lines of changes, and a one sentence changelog.
Quoted 3 lines
Signed-off-by "Darrick J. Wong" <[email protected]>Signed-off-by Catherine Hoang <[email protected]>
An odd Signed-off-by chain.
Quoted 11 lines
--- common/atomicwrites | 10 ++++ tests/generic/1222 | 89 ++++++++++++++++++++++++++++ tests/generic/1222.out | 10 ++++ tests/generic/1223 | 67 +++++++++++++++++++++ tests/generic/1223.out | 9 +++ tests/generic/1224 | 86 +++++++++++++++++++++++++++ tests/generic/1224.out | 16 ++++++ tests/generic/1225 | 128 +++++++++++++++++++++++++++++++++++++++++ tests/generic/1225.out | 21 +++++++ 9 files changed, 436 insertions(+)
Quoted 8 lines
create mode 100755 tests/generic/1222
create mode 100644 tests/generic/1222.out
create mode 100755 tests/generic/1223
create mode 100644 tests/generic/1223.out
create mode 100755 tests/generic/1224
create mode 100644 tests/generic/1224.out
create mode 100755 tests/generic/1225
create mode 100644 tests/generic/1225.out
This all looks ok, I would suggest a separate patch per test and I don't feel strongly about that
Thanks,
John
PATCH v3 3/3 xfs: more multi-block atomic writes tests
In reply to Catherine HoangAdd xfs specific tests for realtime volumes and error recovery.
--- tests/xfs/1216 | 68 ++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1216.out | 9 ++++++ tests/xfs/1217 | 71 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1217.out | 3 ++ tests/xfs/1218 | 60 +++++++++++++++++++++++++++++++++++++++ tests/xfs/1218.out | 15 ++++++++++ 6 files changed, 226 insertions(+) create mode 100755 tests/xfs/1216 create mode 100644 tests/xfs/1216.out create mode 100755 tests/xfs/1217 create mode 100644 tests/xfs/1217.out create mode 100755 tests/xfs/1218 create mode 100644 tests/xfs/1218.out
tests/xfs/1216 new file +68 -0
@@ -0,0 +1,68 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Oracle. All Rights Reserved. +# +# FS QA Test 1216 +# +# Validate multi-fsblock realtime file atomic write support with or without hw +# support +# +. ./common/preamble +_begin_fstest auto quick rw atomicwrites + +. ./common/atomicwrites + +_require_realtime +_require_scratch +_require_atomic_write_test_commands +_require_scratch_write_atomic_multi_fsblock + +echo "scratch device atomic write properties" >> $seqres.full +$XFS_IO_PROG -c "statx -r -m $STATX_WRITE_ATOMIC" $SCRATCH_RTDEV >> $seqres.full + +_scratch_mkfs >> $seqres.full +_scratch_mount + +testfile=$SCRATCH_MNT/testfile +touch $testfile + +echo "filesystem atomic write properties" >> $seqres.full +$XFS_IO_PROG -c "statx -r -m $STATX_WRITE_ATOMIC" $testfile >> $seqres.full + +sector_size=$(blockdev --getss $SCRATCH_RTDEV) +min_awu=$(_get_atomic_write_unit_min $testfile) +max_awu=$(_get_atomic_write_unit_max $testfile) + +$XFS_IO_PROG -f -c "falloc 0 $((max_awu * 2))" -c fsync $testfile + +# try outside the advertised sizes +echo "two EINVAL for unsupported sizes" +min_i=$((min_awu / 2)) +_simple_atomic_write $min_i $min_i $testfile -d +max_i=$((max_awu * 2)) +_simple_atomic_write $max_i $max_i $testfile -d + +# try all of the advertised sizes +for ((i = min_awu; i <= max_awu; i *= 2)); do + $XFS_IO_PROG -f -c "falloc 0 $((max_awu * 2))" -c fsync $testfile + _test_atomic_file_writes $i $testfile + _simple_atomic_write $i $i $testfile -d +done + +# does not support buffered io +echo "one EOPNOTSUPP for buffered atomic" +_simple_atomic_write 0 $min_awu $testfile + +# does not support unaligned directio +echo "one EINVAL for unaligned directio" +if [ $sector_size -lt $min_awu ]; then + _simple_atomic_write $sector_size $min_awu $testfile -d +else + # not supported, so fake the output + echo "pwrite: Invalid argument" +fi + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/1216.out new file +9 -0
@@ -0,0 +1,9 @@ +QA output created by 1216 +two EINVAL for unsupported sizes +pwrite: Invalid argument +pwrite: Invalid argument +one EOPNOTSUPP for buffered atomic +pwrite: Operation not supported +one EINVAL for unaligned directio +pwrite: Invalid argument +Silence is golden
tests/xfs/1217 new file +71 -0
71 lines not on this page · raw message
tests/xfs/1217.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 1217 +pwrite: Input/output error +touch: cannot touch 'SCRATCH_MNT/barf': Input/output error
tests/xfs/1218 new file +60 -0
60 lines not on this page · raw message
tests/xfs/1218.out new file +15 -0
@@ -0,0 +1,15 @@ +QA output created by 1218 +Create files +Check files +77e3a730e3c75274c9ce310d7e39f938 SCRATCH_MNT/file1 +77e3a730e3c75274c9ce310d7e39f938 SCRATCH_MNT/file2 +Inject error +Atomic write to a reflinked file +pwrite: Input/output error +FS should be shut down, touch will fail +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error +Remount to replay log +Check files +0df1f61ed02a7e9bee2b8b7665066ddc SCRATCH_MNT/file1 +77e3a730e3c75274c9ce310d7e39f938 SCRATCH_MNT/file2 +FS should be online, touch should succeed
Signature · 1 line
2.34.1
Re: [PATCH v3 3/3] xfs: more multi-block atomic writes tests
Quoted 1 line · Catherine Hoang
Add xfs specific tests for realtime volumes and error recovery.
Again, more details would be nice.
Quoted 4 lines
Signed-off-by "Darrick J. Wong" <[email protected]>Signed-off-by Catherine Hoang <[email protected]>---