Linux block layer
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: linux-block@vger.kernel.org, shinichiro.kawasaki@wdc.com
Cc: John Garry <john.g.garry@oracle.com>
Subject: [PATCH blktests v2 7/9] md/rc: test atomic writes for dm-linear
Date: Mon, 22 Sep 2025 10:24:31 +0000	[thread overview]
Message-ID: <20250922102433.1586402-8-john.g.garry@oracle.com> (raw)
In-Reply-To: <20250922102433.1586402-1-john.g.garry@oracle.com>

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@oracle.com>
---
 tests/md/002.out | 13 +++++++++++++
 tests/md/rc      | 41 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 53 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 ee5934c..3209402 100644
--- a/tests/md/rc
+++ b/tests/md/rc
@@ -19,6 +19,9 @@ _stacked_atomic_test_requires() {
 	_have_driver raid0
 	_have_driver raid1
 	_have_driver raid10
+	_have_driver dm-mod
+	_have_program vgcreate
+	_have_program lvm
 }
 
 _max_pow_of_two_factor() {
@@ -85,6 +88,13 @@ _md_atomics_boundaries_max() {
 
 declare -A MD_DEVICES
 
+_get_vgsize() {
+	local vgsize
+
+	vgsize=$(vgdisplay --units b blktests_vg00 | grep 'VG Size' | tr -d -c 0-9)
+	echo "$vgsize"
+}
+
 _md_atomics_test() {
 	local md_sysfs_max_hw_sectors_kb
 	local md_sysfs_max_hw
@@ -147,7 +157,7 @@ _md_atomics_test() {
 		raw_atomic_write_boundary=0;
 	fi
 
-	for personality in raid0 raid1 raid10; do
+	for personality in raid0 raid1 raid10 dm-linear; do
 		local step_limit
 		if [ "$personality" = raid0 ] || [ "$personality" = raid10 ]
 		then
@@ -215,6 +225,26 @@ _md_atomics_test() {
 				md_dev=$(readlink /dev/md/blktests_md | sed 's|\.\./||')
 			fi
 
+			if [ "$personality" = dm-linear ]
+			then
+				for i in "${MD_DEVICES[@]}"; do
+					pvremove --force /dev/"$i" 2> /dev/null 1>&2
+					pvcreate /dev/"$i" 2> /dev/null 1>&2
+				done
+
+				echo y | vgcreate blktests_vg00 /dev/"${dev0}" /dev/"${dev1}" \
+						/dev/"${dev2}" /dev/"${dev3}" 2> /dev/null 1>&2
+			fi
+
+			if [ "$personality" = dm-linear ]
+			then
+				local vgsize
+
+				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)
@@ -385,6 +415,15 @@ _md_atomics_test() {
 					mdadm --zero-superblock /dev/"$i" 2> /dev/null 1>&2
 				done
 			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
+				for i in "${MD_DEVICES[@]}"; do
+					pvremove --force /dev/"$i" 2> /dev/null 1>&2
+				done
+			fi
 		done
 	done
 }
-- 
2.43.5


  parent reply	other threads:[~2025-09-22 10:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 10:24 [PATCH blktests v2 0/9] Further stacked device atomic writes testing John Garry
2025-09-22 10:24 ` [PATCH blktests v2 1/9] common/rc: add _min() John Garry
2025-09-22 10:24 ` [PATCH blktests v2 2/9] nvme: relocate _nvme_requires and _require_nvme_test_img_size John Garry
2025-09-22 10:24 ` [PATCH blktests v2 3/9] nvme: relocate _require_test_dev_is_nvme John Garry
2025-09-22 10:24 ` [PATCH blktests v2 4/9] md/rc: add _md_atomics_test John Garry
2025-09-22 10:24 ` [PATCH blktests v2 5/9] md/002: convert to use _md_atomics_test John Garry
2025-09-22 10:24 ` [PATCH blktests v2 6/9] md/003: add NVMe atomic write tests for stacked devices John Garry
2025-09-25  8:39   ` Shinichiro Kawasaki
2025-09-25  8:46     ` John Garry
2025-09-25 14:12       ` Shinichiro Kawasaki
2025-09-25 14:14         ` John Garry
2025-09-25 15:02           ` John Garry
2025-09-25 23:53             ` Shinichiro Kawasaki
2025-09-22 10:24 ` John Garry [this message]
2025-09-22 10:24 ` [PATCH blktests v2 8/9] md/rc: test atomic writes for dm-stripe John Garry
2025-09-22 10:24 ` [PATCH blktests v2 9/9] md/rc: test atomic writes for dm-mirror John Garry
2025-09-25 14:09 ` [PATCH blktests v2 0/9] Further stacked device atomic writes testing Shinichiro Kawasaki
2025-09-25 14:13   ` John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250922102433.1586402-8-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox