[PATCH blktests 5/7] md/rc: test atomic writes for dm-linear

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

 



Introduce testing for dm-linear.

We need to use device mapper tools, like vgcreate and lvm.

dm-linear does not require any chunk size to be set, so only test
once.

Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
 tests/md/002.out | 13 +++++++++++++
 tests/md/rc      | 42 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/tests/md/002.out b/tests/md/002.out
index b311a50..5426cf6 100644
--- a/tests/md/002.out
+++ b/tests/md/002.out
@@ -116,4 +116,17 @@ TEST 9 raid10 step 4 - perform a pwritev2 with size of sysfs_atomic_unit_max_byt
 TEST 10 raid10 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 raid10 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 1 dm-linear step 1 - Verify md sysfs atomic attributes matches - pass
+TEST 2 dm-linear step 1 - Verify sysfs atomic attributes - pass
+TEST 3 dm-linear step 1 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
+TEST 4 dm-linear step 1 - Verify sysfs atomic_write_unit_max_bytes =  expected_atomic_write_unit_max - pass
+TEST 5 dm-linear step 1 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
+TEST 6 dm-linear step 1 - Verify statx stx_atomic_write_unit_min - pass
+TEST 7 dm-linear step 1 - Verify statx stx_atomic_write_unit_max - pass
+TEST 8 dm-linear 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-linear 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-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 complete
diff --git a/tests/md/rc b/tests/md/rc
index 105d283..a839a66 100644
--- a/tests/md/rc
+++ b/tests/md/rc
@@ -16,6 +16,8 @@ group_requires() {
 	_have_driver raid1
 	_have_driver raid10
 	_have_driver md-mod
+	_have_program vgcreate
+	_have_program lvm
 }
 
 declare -A MD_DEVICES
@@ -81,6 +83,11 @@ _md_atomics_boundaries_max() {
 	echo "0"
 }
 
+_get_vgsize() {
+	vgsize=$(vgdisplay --units b blktests_vg00 | grep 'VG Size' | tr -d -c 0-9)
+	echo "$vgsize"
+}
+
 _md_atomics_test() {
 	local md_atomic_unit_max
 	local md_atomic_unit_min
@@ -145,7 +152,7 @@ _md_atomics_test() {
 		let raw_atomic_write_boundary=0;
 	fi
 
-	for personality in raid0 raid1 raid10; do
+	for personality in raid0 raid1 raid10 dm-linear; do
 		if [ "$personality" = raid0 ] || [ "$personality" = raid10 ]
 		then
 			step_limit=4
@@ -210,6 +217,29 @@ _md_atomics_test() {
 				md_dev=$(readlink /dev/md/blktests_md | sed 's|\.\./||')
 			fi
 
+			if [ "$personality" = dm-linear ]
+			then
+				pvremove --force /dev/"${dev0}" 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev1}" 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev2}" 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev3}" 2> /dev/null 1>&2
+
+				pvcreate /dev/"${dev0}" 2> /dev/null 1>&2
+				pvcreate /dev/"${dev1}" 2> /dev/null 1>&2
+				pvcreate /dev/"${dev2}" 2> /dev/null 1>&2
+				pvcreate /dev/"${dev3}" 2> /dev/null 1>&2
+
+				echo y | vgcreate blktests_vg00 /dev/"${dev0}" /dev/"${dev1}" \
+						/dev/"${dev2}" /dev/"${dev3}" 2> /dev/null 1>&2
+			fi
+
+			if [ "$personality" = dm-linear ]
+			then
+				vgsize=$(_get_vgsize)
+				echo y | lvm lvcreate -v -n blktests_lv -L "${vgsize}"B blktests_vg00 2> /dev/null 1>&2
+				md_dev=$(readlink /dev/mapper/blktests_vg00-blktests_lv | sed 's|\.\./||')
+			fi
+
 			md_dev_sysfs="/sys/devices/virtual/block/${md_dev}"
 
 			sysfs_logical_block_size=$(< "${md_dev_sysfs}"/queue/logical_block_size)
@@ -380,6 +410,16 @@ _md_atomics_test() {
 				mdadm --zero-superblock /dev/"${dev2}" 2> /dev/null 1>&2
 				mdadm --zero-superblock /dev/"${dev3}" 2> /dev/null 1>&2
 			fi
+
+			if [ "$personality" = dm-linear ]
+			then
+				lvremove --force  /dev/mapper/blktests_vg00-blktests_lv  2> /dev/null 1>&2
+				vgremove --force blktests_vg00 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev0}" 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev1}" 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev2}" 2> /dev/null 1>&2
+				pvremove --force /dev/"${dev3}" 2> /dev/null 1>&2
+			fi
 		done
 	done
 }
-- 
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