[PATCH blktests 6/7] md/rc: test atomic writes for dm-stripe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ensure that the drives are at least 5MB. This is because we need to know
the size of the volume to create. For dm-linear, we could use vgsize.
However that doesn't work for dm-stripe, as we want the volume to cover
all disks; for that, we need to know the minimum size of each disk.

Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
 tests/md/002     |  1 +
 tests/md/002.out | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/md/003     |  1 +
 tests/md/rc      | 28 ++++++++++++++++++++++----
 4 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/tests/md/002 b/tests/md/002
index 87b13f2..0470a1b 100755
--- a/tests/md/002
+++ b/tests/md/002
@@ -22,6 +22,7 @@ test() {
 		num_tgts=1
 		add_host=4
 		per_host_store=true
+		dev_size_mb=5
 	)
 
 	echo "Running md_atomics_test"
diff --git a/tests/md/002.out b/tests/md/002.out
index 5426cf6..cce1b1c 100644
--- a/tests/md/002.out
+++ b/tests/md/002.out
@@ -129,4 +129,56 @@ TEST 9 dm-linear step 1 - perform a pwritev2 with size of sysfs_atomic_unit_max_
 TEST 10 dm-linear step 1 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
 pwrite: Invalid argument
 TEST 11 dm-linear step 1 - perform a pwritev2 with a size of sysfs_atomic_write_unit_max_bytes - LBS bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+TEST 1 dm-stripe step 1 - Verify md sysfs atomic attributes matches - pass
+TEST 2 dm-stripe step 1 - Verify sysfs atomic attributes - pass
+TEST 3 dm-stripe step 1 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
+TEST 4 dm-stripe step 1 - Verify sysfs atomic_write_unit_max_bytes =  expected_atomic_write_unit_max - pass
+TEST 5 dm-stripe step 1 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
+TEST 6 dm-stripe step 1 - Verify statx stx_atomic_write_unit_min - pass
+TEST 7 dm-stripe step 1 - Verify statx stx_atomic_write_unit_max - pass
+TEST 8 dm-stripe step 1 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 9 dm-stripe step 1 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + LBS bytes with RWF_ATOMIC flag - pwritev2 should not be succesful - pass
+TEST 10 dm-stripe step 1 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 11 dm-stripe step 1 - perform a pwritev2 with a size of sysfs_atomic_write_unit_max_bytes - LBS bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+TEST 1 dm-stripe step 2 - Verify md sysfs atomic attributes matches - pass
+TEST 2 dm-stripe step 2 - Verify sysfs atomic attributes - pass
+TEST 3 dm-stripe step 2 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
+TEST 4 dm-stripe step 2 - Verify sysfs atomic_write_unit_max_bytes =  expected_atomic_write_unit_max - pass
+TEST 5 dm-stripe step 2 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
+TEST 6 dm-stripe step 2 - Verify statx stx_atomic_write_unit_min - pass
+TEST 7 dm-stripe step 2 - Verify statx stx_atomic_write_unit_max - pass
+TEST 8 dm-stripe step 2 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 9 dm-stripe step 2 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + LBS bytes with RWF_ATOMIC flag - pwritev2 should not be succesful - pass
+TEST 10 dm-stripe step 2 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 11 dm-stripe step 2 - perform a pwritev2 with a size of sysfs_atomic_write_unit_max_bytes - LBS bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+TEST 1 dm-stripe step 3 - Verify md sysfs atomic attributes matches - pass
+TEST 2 dm-stripe step 3 - Verify sysfs atomic attributes - pass
+TEST 3 dm-stripe step 3 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
+TEST 4 dm-stripe step 3 - Verify sysfs atomic_write_unit_max_bytes =  expected_atomic_write_unit_max - pass
+TEST 5 dm-stripe step 3 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
+TEST 6 dm-stripe step 3 - Verify statx stx_atomic_write_unit_min - pass
+TEST 7 dm-stripe step 3 - Verify statx stx_atomic_write_unit_max - pass
+TEST 8 dm-stripe step 3 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 9 dm-stripe step 3 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + LBS bytes with RWF_ATOMIC flag - pwritev2 should not be succesful - pass
+TEST 10 dm-stripe step 3 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 11 dm-stripe step 3 - perform a pwritev2 with a size of sysfs_atomic_write_unit_max_bytes - LBS bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+TEST 1 dm-stripe step 4 - Verify md sysfs atomic attributes matches - pass
+TEST 2 dm-stripe step 4 - Verify sysfs atomic attributes - pass
+TEST 3 dm-stripe step 4 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
+TEST 4 dm-stripe step 4 - Verify sysfs atomic_write_unit_max_bytes =  expected_atomic_write_unit_max - pass
+TEST 5 dm-stripe step 4 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
+TEST 6 dm-stripe step 4 - Verify statx stx_atomic_write_unit_min - pass
+TEST 7 dm-stripe step 4 - Verify statx stx_atomic_write_unit_max - pass
+TEST 8 dm-stripe step 4 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 9 dm-stripe step 4 - perform a pwritev2 with size of sysfs_atomic_unit_max_bytes + LBS bytes with RWF_ATOMIC flag - pwritev2 should not be succesful - pass
+TEST 10 dm-stripe step 4 - perform a pwritev2 with size of sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
+pwrite: Invalid argument
+TEST 11 dm-stripe step 4 - perform a pwritev2 with a size of sysfs_atomic_write_unit_max_bytes - LBS bytes with RWF_ATOMIC flag - pwritev2 should fail - pass
 Test complete
diff --git a/tests/md/003 b/tests/md/003
index 8128f8d..3e97657 100755
--- a/tests/md/003
+++ b/tests/md/003
@@ -37,6 +37,7 @@ test() {
 		TEST_DEV_SYSFS="${NVME_TEST_DEVS_SYSFS[$i]}"
 		TEST_DEV="${NVME_TEST_DEVS[$i]}"
 		_require_device_support_atomic_writes
+		_require_test_dev_size 5m
 	done
 
 	if [[ $testdev_count -lt 4 ]]; then
diff --git a/tests/md/rc b/tests/md/rc
index a839a66..da04b4a 100644
--- a/tests/md/rc
+++ b/tests/md/rc
@@ -152,8 +152,9 @@ _md_atomics_test() {
 		let raw_atomic_write_boundary=0;
 	fi
 
-	for personality in raid0 raid1 raid10 dm-linear; do
-		if [ "$personality" = raid0 ] || [ "$personality" = raid10 ]
+	for personality in raid0 raid1 raid10 dm-linear dm-stripe; do
+		if [ "$personality" = raid0 ] || [ "$personality" = raid10 ] || \
+		    [ "$personality" = dm-stripe ]
 		then
 			step_limit=4
 		else
@@ -217,7 +218,7 @@ _md_atomics_test() {
 				md_dev=$(readlink /dev/md/blktests_md | sed 's|\.\./||')
 			fi
 
-			if [ "$personality" = dm-linear ]
+			if [ "$personality" = dm-linear ] || [ "$personality" = dm-stripe ]
 			then
 				pvremove --force /dev/"${dev0}" 2> /dev/null 1>&2
 				pvremove --force /dev/"${dev1}" 2> /dev/null 1>&2
@@ -233,6 +234,25 @@ _md_atomics_test() {
 						/dev/"${dev2}" /dev/"${dev3}" 2> /dev/null 1>&2
 			fi
 
+			if [ "$personality" = dm-stripe ]
+			then
+				atomics_boundaries_unit_max=$(_md_atomics_boundaries_max $raw_atomic_write_boundary $md_chunk_size "1")
+				atomics_boundaries_max=$(_md_atomics_boundaries_max $raw_atomic_write_boundary $md_chunk_size "0")
+
+				# The caller should ensure test device size, we ask for a total of 10M
+				# So each should be at least (10M + meta) / 4 in size, so 5 each should be enough
+				echo y | lvm lvcreate --stripes 4 --stripesize "${md_chunk_size_kb}" -L 10M \
+					-n blktests_lv blktests_vg00 2> /dev/null 1>&2
+				md_dev=$(readlink /dev/mapper/blktests_vg00-blktests_lv | sed 's|\.\./||')
+				expected_atomic_write_unit_min=$(_min $expected_atomic_write_unit_min $atomics_boundaries_unit_max)
+				expected_atomic_write_unit_max=$(_min $expected_atomic_write_unit_max $atomics_boundaries_unit_max)
+				expected_atomic_write_max=$(_min $expected_atomic_write_max $atomics_boundaries_max)
+				if [ "$atomics_boundaries_max" -eq 0 ]
+				then
+					expected_atomic_write_boundary=0
+				fi
+			fi
+
 			if [ "$personality" = dm-linear ]
 			then
 				vgsize=$(_get_vgsize)
@@ -411,7 +431,7 @@ _md_atomics_test() {
 				mdadm --zero-superblock /dev/"${dev3}" 2> /dev/null 1>&2
 			fi
 
-			if [ "$personality" = dm-linear ]
+			if [ "$personality" = dm-linear ] || [ "$personality" = dm-stripe ]
 			then
 				lvremove --force  /dev/mapper/blktests_vg00-blktests_lv  2> /dev/null 1>&2
 				vgremove --force blktests_vg00 2> /dev/null 1>&2
-- 
2.43.5





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux