Skip to contentSkip to conversation

Add atomic write tests for scsi and nvme

PATCH Superseded Alan Adamson 2 participants 6 messages Jan 28, 2025 – Feb 4, 2025

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add atomic write tests for scsi and nvme

Changes in v2:
- Add additional comments in common/xfs
- Remove xfs_io and kernel version checking
- Simplify paths for sysfs attributes
- Fix failed case output (missing echo) in scsi/009
- Add local variable that sets Test # and description (test_desc) for scsi/009 and nvme/059
- Only use scsi_debug device if no scsi test device is provided.
- nvme testing done with qemu-nvme.
- scsi testing done with scsi_debug and qemu-scsi (no atomic write support). No testing on atomic write capable scsi devices was done.
-------------------------------------------------------------------------------------------
Add tests for atomic write support.

Tests will be delivered for scsi (using scsi_debug) and nvme. NVMe can use the qemu-nvme emulated device that supports Controller-based Atomic Parameters (QEMU 9.2).

The xfs_io utility delivered with the xfsprogs-devel package (version 6.12) is required by these tests.

The Linux Kernel 6.11 (and greater) supports Atomic Writes and is required by these tests.

#1 lore raw

PATCH v2 1/2 scsi/009: add atomic write tests

Tests basic atomic write functionality. If no scsi test device is provided, a scsi_debug device will be used. Testing areas include:

- Verify sysfs atomic write attributes are consistent with atomic write attributes advertised by scsi_debug.
- Verify the atomic write paramters of statx are correct using xfs_io.
- Perform a pwritev2() (with and without RWF_ATOMIC flag) using xfs_io:
- maximum byte size (atomic_write_unit_max_bytes)
- minimum byte size (atomic_write_unit_min_bytes)
- a write larger than atomic_write_unit_max_bytes
- a write smaller than atomic_write_unit_min_bytes

---
 common/xfs         |  61 ++++++++++++
 tests/scsi/009     | 233 +++++++++++++++++++++++++++++++++++++++++++++
 tests/scsi/009.out |  18 ++++
 3 files changed, 312 insertions(+)
 create mode 100755 tests/scsi/009
 create mode 100644 tests/scsi/009.out
common/xfs +61 -0
index 569770fecd53..5db052be7e1c 100644
@@ -6,6 +6,30 @@
 
 . common/shellcheck
 
+_have_xfs_io() {
+	if ! _have_program xfs_io; then
+		return 1
+	fi
+	return 0
+}
+
+# Check whether the version of xfs_io is greater than or equal to $1.$2.$3
+
+_have_xfs_io_atomic_write() {
+	local s
+
+	_have_xfs_io || return $?
+
+	# If the pwrite command supports the -A option then this version
+	# of xfs_io supports atomic writes.
+	s=$(xfs_io -c help | grep pwrite | awk '{ print $4}')
+	if [[ $s == *"A"* ]];
+	then
+		return 0
+	fi
+	return 1
+}
+
 _have_xfs() {
 	_have_fs xfs && _have_program mkfs.xfs
 }
@@ -52,3 +76,40 @@ _xfs_run_fio_verify_io() {
 
 	return "${rc}"
 }
+
+# Use xfs_io to perform a non-atomic write using pwritev2().
+# Args:    $1 - device to write to
+#          $2 - number of bytes to write
+# Returns: Number of bytes written
+run_xfs_io_pwritev2() {
+	local dev=$1
+	local bytes_to_write=$2
+	local bytes_written
+
+	# Perform write and extract out bytes written from xfs_io output
+	bytes_written=$(xfs_io -d -C "pwrite -b ${bytes_to_write} -V 1 -D 0 ${bytes_to_write}" "$dev" | grep "wrote" | sed 's/\// /g' | awk '{ print $2 }')
+	echo "$bytes_written"
+}
+
+# Use xfs_io to perform an atomic write using pwritev2().
+# Args:    $1 - device to write to
+#          $2 - number of bytes to write
+# Returns: Number of bytes written
+run_xfs_io_pwritev2_atomic() {
+	local dev=$1
+	local bytes_to_write=$2
+	local bytes_written
+
+	# Perform atomic write and extract out bytes written from xfs_io output
+	bytes_written=$(xfs_io -d -C "pwrite -b ${bytes_to_write} -V 1 -A -D 0 ${bytes_to_write}" "$dev" | grep "wrote" | sed 's/\// /g' | awk '{ print $2 }')
+	echo "$bytes_written"
+}
+
+run_xfs_io_xstat() {
+	local dev=$1
+	local field=$2
+	local statx_output
+
+	statx_output=$(xfs_io -c "statx -r -m 0x00010000" "$dev" | grep "$field" | awk '{ print $3 }')
+	echo "$statx_output"
+}
tests/scsi/009 new file +233 -0

233 lines not on this page · raw message

tests/scsi/009.out new file +18 -0
new file mode 100644
index 000000000000..e31416b93515
@@ -0,0 +1,18 @@
+Running scsi/009
+TEST 1 - Verify sysfs atomic attributes - pass
+TEST 2 - check scsi_debug atomic_wr_max_length is the same as sysfs atomic_write_max_bytes - pass
+TEST 3 - check sysfs atomic_write_unit_max_bytes <= scsi_debug atomic_wr_max_length - pass
+TEST 4 - check sysfs atomic_write_unit_min_bytes = scsi_debug atomic_wr_gran - pass
+TEST 5 - check statx stx_atomic_write_unit_min - pass
+TEST 6 - check statx stx_atomic_write_unit_max - pass
+TEST 7 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with no RWF_ATOMIC flag - pwritev2 should be succesful - pass
+TEST 8 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with RWF_ATOMIC flag - pwritev2 should be succesful - pass
+TEST 9 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + 512 bytes with no RWF_ATOMIC flag - pwritev2 should be succesful - pass
+pwrite: Invalid argument
+TEST 10 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + 512 bytes with RWF_ATOMIC flag - pwritev2 should not be succesful - pass
+TEST 11 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with no RWF_ATOMIC flag - pwritev2 should be succesful - pass
+TEST 12 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should be succesful - pass
+TEST 13 - perform a pwritev2 with a size of sysfs_atomic_unit_min_bytes - 512 bytes with no RWF_ATOMIC flag - pwritev2 should be succesful - pass
+pwrite: Invalid argument
+TEST 14 - perform a pwritev2 with a size of sysfs_atomic_unit_min_bytes - 512 bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+Test complete
Signature · 1 line
2.43.5
#2 lore raw

Re: [PATCH v2 blktests 1/2] scsi/009: add atomic write tests

Thanks for the v2 patches. Please find my comments below.

Quoted 28 lines · Alan Adamson

Tests basic atomic write functionality. If no scsi test device is provided, a scsi_debug device will be used. Testing areas include:

- Verify sysfs atomic write attributes are consistent with atomic write attributes advertised by scsi_debug.
- Verify the atomic write paramters of statx are correct using xfs_io.
- Perform a pwritev2() (with and without RWF_ATOMIC flag) using xfs_io:
- maximum byte size (atomic_write_unit_max_bytes)
- minimum byte size (atomic_write_unit_min_bytes)
- a write larger than atomic_write_unit_max_bytes
- a write smaller than atomic_write_unit_min_bytes

---
 common/xfs         |  61 ++++++++++++
 tests/scsi/009     | 233 +++++++++++++++++++++++++++++++++++++++++++++
 tests/scsi/009.out |  18 ++++
 3 files changed, 312 insertions(+)
 create mode 100755 tests/scsi/009
 create mode 100644 tests/scsi/009.out
common/xfs +0 -0
index 569770fecd53..5db052be7e1c 100644

common/xfs line 14

Quoted 9 lines
common/xfs +6 -0
@@ -6,6 +6,30 @@
 
 . common/shellcheck
 
+_have_xfs_io() {
+	if ! _have_program xfs_io; then
+		return 1
+	fi
+	return 0
+}

This helper function is used only one place, so it does not add much value. I think "_have_program xfs_io" is enough for this patch. I would say null_blk and scsi_debug are exceptions. They are used at many places in blktests, so they have the value to have special helper _have_null_blk and _have_scsi_debug.

common/xfs line 16

Quoted 2 lines
common/xfs +2 -0
+
+# Check whether the version of xfs_io is greater than or equal to $1.$2.$3

This line should be removed.

common/xfs line 29

Quoted 13 lines
common/xfs +13 -0
+
+_have_xfs_io_atomic_write() {
+	local s
+
+	_have_xfs_io || return $?
+
+	# If the pwrite command supports the -A option then this version
+	# of xfs_io supports atomic writes.
+	s=$(xfs_io -c help | grep pwrite | awk '{ print $4}')
+	if [[ $s == *"A"* ]];
+	then
+		return 0
+	fi

SKIP_REASONS+=("..") should be set here, or the test cases are not skipped even with older xfs_io.

Quoted 12 lines
common/xfs +5 -0
+	return 1
+}
+
 _have_xfs() {
 	_have_fs xfs && _have_program mkfs.xfs
 }
@@ -52,3 +76,40 @@ _xfs_run_fio_verify_io() {
 
 	return "${rc}"
 }
+
+# Use xfs_io to perform a non-atomic write using pwritev2().

common/xfs _xfs_run_fio_verify_io() { · line 90

Quoted 10 lines
common/xfs +10 -0
+# Args:    $1 - device to write to
+#          $2 - number of bytes to write
+# Returns: Number of bytes written
+run_xfs_io_pwritev2() {
+	local dev=$1
+	local bytes_to_write=$2
+	local bytes_written
+
+	# Perform write and extract out bytes written from xfs_io output
+	bytes_written=$(xfs_io -d -C "pwrite -b ${bytes_to_write} -V 1 -D 0 ${bytes_to_write}" "$dev" | grep "wrote" | sed 's/\// /g' | awk '{ print $2 }')

This line is lengthy and hard to read. Can we split it with \ to fit in 80 characters?

Quoted 4 lines
common/xfs +4 -0
+	echo "$bytes_written"
+}
+
+# Use xfs_io to perform an atomic write using pwritev2().

common/xfs _xfs_run_fio_verify_io() { · line 104

Quoted 10 lines
common/xfs +10 -0
+# Args:    $1 - device to write to
+#          $2 - number of bytes to write
+# Returns: Number of bytes written
+run_xfs_io_pwritev2_atomic() {
+	local dev=$1
+	local bytes_to_write=$2
+	local bytes_written
+
+	# Perform atomic write and extract out bytes written from xfs_io output
+	bytes_written=$(xfs_io -d -C "pwrite -b ${bytes_to_write} -V 1 -A -D 0 ${bytes_to_write}" "$dev" | grep "wrote" | sed 's/\// /g' | awk '{ print $2 }')

Same here.

common/xfs _xfs_run_fio_verify_io() { · line 113

Quoted 9 lines
common/xfs +9 -0
+	echo "$bytes_written"
+}
+
+run_xfs_io_xstat() {
+	local dev=$1
+	local field=$2
+	local statx_output
+
+	statx_output=$(xfs_io -c "statx -r -m 0x00010000" "$dev" | grep "$field" | awk '{ print $3 }')

Same here.

Quoted 23 lines
common/xfs +2 -0
+	echo "$statx_output"
+}
tests/scsi/009 new file +15 -0
new file mode 100755
index 000000000000..7624447a6633
@@ -0,0 +1,233 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Oracle and/or its affiliates
+#
+# Test SCSI Atomic Writes with scsi_debug
+
+. tests/scsi/rc
+. common/scsi_debug
+. common/xfs
+
+DESCRIPTION="test scsi atomic writes"
+QUICK=1
+
+requires() {
+	_have_driver scsi_debug

tests/scsi/009 line 25

Quoted 10 lines
tests/scsi/009 new file +10 -0
+	_have_xfs_io_atomic_write
+}
+
+device_requires() {
+	_require_test_dev_sysfs queue/atomic_write_max_bytes
+	if (( $(< "${TEST_DEV_SYSFS}"/queue/atomic_write_max_bytes) == 0 )); then
+		SKIP_REASONS+=("${TEST_DEV} does not support atomic write")
+		return 1
+	fi
+}

This check in device_requires() looks exactly same as that in nvme/059. I suggest factor it out to a helper function in common/rc.

Other than the above comments, this patch looks good to me.

#3 lore raw

PATCH v2 2/2 nvme/059: add atomic write tests

In reply to Alan Adamson

Tests basic atomic write functionality using NVMe devices that support the AWUN and AWUPF Controller Atomic Parameters and NAWUN and NAWUPF Namespace Atomic Parameters.

Testing areas include:

- Verify sysfs atomic write attributes are consistent with atomic write capablities advertised by the NVMe HW.

- Verify the atomic write paramters of statx are correct using xfs_io.

- Perform a pwritev2() (with and without RWF_ATOMIC flag) using xfs_io:
- maximum byte size (atomic_write_unit_max_bytes)
- a write larger than atomic_write_unit_max_bytes

---
 tests/nvme/059     | 151 +++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/059.out |  10 +++
 2 files changed, 161 insertions(+)
 create mode 100755 tests/nvme/059
 create mode 100644 tests/nvme/059.out
tests/nvme/059 new file +151 -0
new file mode 100755
index 000000000000..032f793e222d
@@ -0,0 +1,151 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Oracle and/or its affiliates
+#
+# Test NVMe Atomic Writes
+
+. tests/nvme/rc
+. common/xfs
+
+DESCRIPTION="test atomic writes"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_program nvme
+	_have_xfs_io_atomic_write
+}
+
+device_requires() {
+	_require_test_dev_sysfs queue/atomic_write_max_bytes
+	if (( $(< "${TEST_DEV_SYSFS}"/queue/atomic_write_max_bytes) == 0 )); then
+		SKIP_REASONS+=("${TEST_DEV} does not support atomic write")
+		return 1
+	fi
+}
+
+test_device() {
+	local ns_dev
+	local ctrl_dev
+	local queue_path
+	local nvme_awupf
+	local nvme_nsfeat
+	local nvme_nsabp
+	local atomic_max_bytes
+	local statx_atomic_max
+	local sysfs_atomic_max_bytes
+	local sysfs_atomic_unit_max_bytes
+	local sysfs_logical_block_size
+	local bytes_written
+	local bytes_to_write
+	local test_desc
+
+	echo "Running ${TEST_NAME}"
+	ns_dev=${TEST_DEV##*/}
+	ctrl_dev=${ns_dev%n*}
+	queue_path="${TEST_DEV_SYSFS}/queue/"
+
+	test_desc="TEST 1 - Verify sysfs attributes"
+
+	sysfs_logical_block_size=$(cat "$queue_path"/logical_block_size)
+	sysfs_max_hw_sectors_kb=$(cat "$queue_path"/max_hw_sectors_kb)
+	max_hw_bytes=$(( "$sysfs_max_hw_sectors_kb" * 1024 ))
+	sysfs_atomic_max_bytes=$(cat "$queue_path"/atomic_write_max_bytes)
+	sysfs_atomic_unit_max_bytes=$(cat "$queue_path"/atomic_write_unit_max_bytes)
+	sysfs_atomic_unit_min_bytes=$(cat "$queue_path"/atomic_write_unit_min_bytes)
+
+	if [ "$max_hw_bytes" -ge "$sysfs_atomic_max_bytes" ] &&
+		[ "$sysfs_atomic_max_bytes" -ge "$sysfs_atomic_unit_max_bytes" ] &&
+		[ "$sysfs_atomic_unit_max_bytes" -ge "$sysfs_atomic_unit_min_bytes" ]
+	then
+		echo "$test_desc - pass"
+	else
+		echo "$test_desc - fail $max_hw_bytes - $sysfs_max_hw_sectors_kb -" \
+			"$sysfs_atomic_max_bytes - $sysfs_atomic_unit_max_bytes -" \
+			"$sysfs_atomic_unit_min_bytes"
+	fi
+
+	test_desc="TEST 2 - Verify sysfs atomic_write_unit_max_bytes is consistent "
+	test_desc+="with NVMe AWUPF/NAWUPF"
+	nvme_nsfeat=$(nvme id-ns /dev/"${ns_dev}" | grep nsfeat | awk '{ print $3}')
+	nvme_nsabp=$((("$nvme_nsfeat" & 0x2) != 0))
+	if [ "$nvme_nsabp" = 1 ] # Check if NSABP is set
+	then
+		nvme_awupf=$(nvme id-ns /dev/"$ns_dev" | grep nawupf | awk '{ print $3}')
+		atomic_max_bytes=$(( ("$nvme_awupf" + 1) * "$sysfs_logical_block_size" ))
+	else
+		nvme_awupf=$(nvme id-ctrl /dev/"${ctrl_dev}" | grep awupf | awk '{ print $3}')
+		atomic_max_bytes=$(( ("$nvme_awupf" + 1) * "$sysfs_logical_block_size" ))
+	fi
+	if [ "$atomic_max_bytes" -le "$max_hw_bytes" ]
+	then
+		if [ "$atomic_max_bytes" = "$sysfs_atomic_max_bytes" ]
+		then
+			echo "$test_desc - pass"
+		else
+			echo "$test_desc - fail $nvme_nsabp - $atomic_max_bytes - $sysfs_atomic_max_bytes -" \
+				"$max_hw_bytes"
+		fi
+	else
+		if [ "$sysfs_atomic_max_bytes" = "$max_hw_bytes" ]
+		then
+			echo "$test_desc - pass"
+		else
+			echo "$test_desc - fail $nvme_nsabp - $atomic_max_bytes - $sysfs_atomic_max_bytes -" \
+				"$max_hw_bytes"
+		fi
+	fi
+
+	test_desc="TEST 3 - Verify statx is correctly reporting atomic_unit_max_bytes"
+	statx_atomic_max=$(run_xfs_io_xstat /dev/"$ns_dev" "stat.atomic_write_unit_max")
+	if [ "$sysfs_atomic_unit_max_bytes" = "$statx_atomic_max" ]
+	then
+		echo "$test_desc - pass"
+	else
+		echo "$test_desc - fail $statx_atomic_max - $sysfs_atomic_unit_max_bytes"
+	fi
+
+	test_desc="TEST 4 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes "\
+	test_desc+="with no RWF_ATOMIC"
+	# flag - pwritev2 should be succesful.
+        bytes_written=$(run_xfs_io_pwritev2 /dev/"$ns_dev" "$sysfs_atomic_unit_max_bytes")
+        if [ "$bytes_written" = "$sysfs_atomic_unit_max_bytes" ]
+        then
+                echo "$test_desc - pass"
+        else
+                echo "$test_desc - fail $bytes_written - $sysfs_atomic_unit_max_bytes"
+        fi
+
+	test_desc="TEST 5 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with "
+	test_desc+="RWF_ATOMIC flag - pwritev2 should  be succesful"
+	bytes_written=$(run_xfs_io_pwritev2_atomic /dev/"$ns_dev" "$sysfs_atomic_unit_max_bytes")
+	if [ "$bytes_written" = "$sysfs_atomic_unit_max_bytes" ]
+	then
+		echo "$test_desc - pass"
+	else
+		echo "$test_desc - fail $bytes_written - $sysfs_atomic_unit_max_bytes"
+	fi
+
+	test_desc="TEST 6 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + 1 logical "
+	test_desc+="block with no RWF_ATOMIC flag - pwritev2 should be succesful"
+	bytes_to_write=$(( "$sysfs_atomic_unit_max_bytes" + "$sysfs_logical_block_size" ))
+	bytes_written=$(run_xfs_io_pwritev2 /dev/"$ns_dev" "$bytes_to_write")
+	if [ "$bytes_written" = "$bytes_to_write" ]
+	then
+		echo "$test_desc - pass"
+	else
+		echo "$test_desc - fail $bytes_written - $bytes_to_write"
+	fi
+
+	test_desc="TEST 7 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + logical "
+	test_desc+="block with RWF_ATOMIC flag - pwritev2 should not be succesful"
+	bytes_written=$(run_xfs_io_pwritev2_atomic /dev/"$ns_dev" "$bytes_to_write")
+	if [ "$bytes_written" = "" ]
+	then
+		echo "$test_desc - pass"
+	else
+		echo "$test_desc - fail $bytes_written - $bytes_to_write"
+	fi
+
+	echo "Test complete"
+}
tests/nvme/059.out new file +10 -0
new file mode 100644
index 000000000000..e803de35776f
@@ -0,0 +1,10 @@
+Running nvme/059
+TEST 1 - Verify sysfs attributes - pass
+TEST 2 - Verify sysfs atomic_write_unit_max_bytes is consistent with NVMe AWUPF/NAWUPF - pass
+TEST 3 - Verify statx is correctly reporting atomic_unit_max_bytes - pass
+TEST 4 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with no RWF_ATOMIC - pass
+TEST 5 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with RWF_ATOMIC flag - pwritev2 should  be succesful - pass
+TEST 6 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + 1 logical block with no RWF_ATOMIC flag - pwritev2 should be succesful - pass
+pwrite: Invalid argument
+TEST 7 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + logical block with RWF_ATOMIC flag - pwritev2 should not be succesful - pass
+Test complete
Signature · 1 line
2.43.5
#4 lore raw

Re: [PATCH v2 blktests 2/2] nvme/059: add atomic write tests

Quoted 9 lines · Alan Adamson

Tests basic atomic write functionality using NVMe devices that support the AWUN and AWUPF Controller Atomic Parameters and NAWUN and NAWUPF Namespace Atomic Parameters.

Testing areas include:

- Verify sysfs atomic write attributes are consistent with atomic write capablities advertised by the NVMe HW.

Quoted 7 lines

- Verify the atomic write paramters of statx are correct using xfs_io.

- Perform a pwritev2() (with and without RWF_ATOMIC flag) using xfs_io:
- maximum byte size (atomic_write_unit_max_bytes)
- a write larger than atomic_write_unit_max_bytes

These test contests are smallre than those in scsi/009. Is it intentional? No "minimum byte size" test, and no "a write smaller than atomic_write_unit_min_bytes" test.

Quoted 30 lines
---
 tests/nvme/059     | 151 +++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/059.out |  10 +++
 2 files changed, 161 insertions(+)
 create mode 100755 tests/nvme/059
 create mode 100644 tests/nvme/059.out
tests/nvme/059 new file +15 -0
new file mode 100755
index 000000000000..032f793e222d
@@ -0,0 +1,151 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Oracle and/or its affiliates
+#
+# Test NVMe Atomic Writes
+
+. tests/nvme/rc
+. common/xfs
+
+DESCRIPTION="test atomic writes"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_program nvme

tests/nvme/059 line 25

Quoted 10 lines
tests/nvme/059 new file +10 -0
+	_have_xfs_io_atomic_write
+}
+
+device_requires() {
+	_require_test_dev_sysfs queue/atomic_write_max_bytes
+	if (( $(< "${TEST_DEV_SYSFS}"/queue/atomic_write_max_bytes) == 0 )); then
+		SKIP_REASONS+=("${TEST_DEV} does not support atomic write")
+		return 1
+	fi
+}

As I commented for the other patch, I suggest to factor out the check in device_requires().

#5 lore raw

Re: [PATCH v2 blktests 2/2] nvme/059: add atomic write tests

Quoted 13 lines · Shinichiro Kawasaki
Quoted 12 lines · Alan Adamson

Tests basic atomic write functionality using NVMe devices that support the AWUN and AWUPF Controller Atomic Parameters and NAWUN and NAWUPF Namespace Atomic Parameters.

Testing areas include:

- Verify sysfs atomic write attributes are consistent with atomic write capablities advertised by the NVMe HW.

- Verify the atomic write paramters of statx are correct using xfs_io.

Quoted 7 lines
Quoted 4 lines

- Perform a pwritev2() (with and without RWF_ATOMIC flag) using xfs_io:
- maximum byte size (atomic_write_unit_max_bytes)
- a write larger than atomic_write_unit_max_bytes

These test contests are smallre than those in scsi/009. Is it intentional? No "minimum byte size" test, and no "a write smaller than atomic_write_unit_min_bytes" test.

SCSI supports atomic writes a bit differently than NVMe.  SCSI has an atomic granularity which translates to a minimum write size when doing an atomic write.  NVMe doesn't have this concept and always guarantees writes of 1 block will be atomic so the additional tests aren't need for NVMe.

Alan