On 08/04/2025 08:59, Catherine Hoang wrote:
Add a test to validate the new atomic writes feature. Signed-off-by: Catherine Hoang<catherine.hoang@xxxxxxxxxx> Reviewed-by: Nirjhar Roy (IBM)<nirjhar.roy.lists@xxxxxxxxx>
Please see comment below, but this seems ok apart from that: Reviewed-by: John Garry <john.g.garry@xxxxxxxxxx>
--- common/rc | 51 +++++++++++++ tests/generic/765 | 172 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/765.out | 2 + 3 files changed, 225 insertions(+) create mode 100755 tests/generic/765 create mode 100644 tests/generic/765.out diff --git a/common/rc b/common/rc index 16d627e1..25e6a1f7 100644
+} + +sys_min_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_min_bytes") +sys_max_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_max_bytes") + +bdev_min_write=$(_get_atomic_write_unit_min $SCRATCH_DEV) +bdev_max_write=$(_get_atomic_write_unit_max $SCRATCH_DEV) + +if [ "$sys_min_write" -ne "$bdev_min_write" ]; then + echo "bdev min write != sys min write" +fi +if [ "$sys_max_write" -ne "$bdev_max_write" ]; then + echo "bdev max write != sys max write"
Note: for large atomic writes according to [0], these may not be the same. I am not sure how this will affect your test.
[0] https://lore.kernel.org/linux-xfs/20250408104209.1852036-1-john.g.garry@xxxxxxxxxx/T/#m374933d93697082f9267515f807930d774c8634b
+fi + +# Test all supported block sizes between bdev min and max +for ((bsize=$bdev_min_write; bsize<=bdev_max_write; bsize*=2)); do + test_atomic_writes $bsize +done; + +# Check that atomic write fails if bsize < bdev min or bsize > bdev max +test_atomic_write_bounds $((bdev_min_write / 2)) +test_atomic_write_bounds $((bdev_max_write * 2)) + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/generic/765.out b/tests/generic/765.out new file mode 100644 index 00000000..39c254ae --- /dev/null +++ b/tests/generic/765.out @@ -0,0 +1,2 @@ +QA output created by 765 +Silence is golden -- 2.34.1