Skip to content

Commit 9c015b7

Browse files
johnpgarrykawasaki
authored andcommitted
md/rc: test atomic writes for dm-stripe
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 <[email protected]> [Shin'ichiro: fixed a couple of shellcheck warnings] Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent e1f8030 commit 9c015b7

4 files changed

Lines changed: 79 additions & 4 deletions

File tree

tests/md/002

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ test() {
2323
num_tgts=1
2424
add_host=4
2525
per_host_store=true
26+
dev_size_mb=5
2627
)
2728

2829
echo "Running md_atomics_test"

tests/md/002.out

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,56 @@ TEST 9 dm-linear step 1 - perform a pwritev2 with size of sysfs_atomic_unit_max_
129129
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
130130
pwrite: Invalid argument
131131
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
132+
TEST 1 dm-stripe step 1 - Verify md sysfs atomic attributes matches - pass
133+
TEST 2 dm-stripe step 1 - Verify sysfs atomic attributes - pass
134+
TEST 3 dm-stripe step 1 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
135+
TEST 4 dm-stripe step 1 - Verify sysfs atomic_write_unit_max_bytes = expected_atomic_write_unit_max - pass
136+
TEST 5 dm-stripe step 1 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
137+
TEST 6 dm-stripe step 1 - Verify statx stx_atomic_write_unit_min - pass
138+
TEST 7 dm-stripe step 1 - Verify statx stx_atomic_write_unit_max - pass
139+
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
140+
pwrite: Invalid argument
141+
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
142+
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
143+
pwrite: Invalid argument
144+
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
145+
TEST 1 dm-stripe step 2 - Verify md sysfs atomic attributes matches - pass
146+
TEST 2 dm-stripe step 2 - Verify sysfs atomic attributes - pass
147+
TEST 3 dm-stripe step 2 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
148+
TEST 4 dm-stripe step 2 - Verify sysfs atomic_write_unit_max_bytes = expected_atomic_write_unit_max - pass
149+
TEST 5 dm-stripe step 2 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
150+
TEST 6 dm-stripe step 2 - Verify statx stx_atomic_write_unit_min - pass
151+
TEST 7 dm-stripe step 2 - Verify statx stx_atomic_write_unit_max - pass
152+
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
153+
pwrite: Invalid argument
154+
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
155+
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
156+
pwrite: Invalid argument
157+
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
158+
TEST 1 dm-stripe step 3 - Verify md sysfs atomic attributes matches - pass
159+
TEST 2 dm-stripe step 3 - Verify sysfs atomic attributes - pass
160+
TEST 3 dm-stripe step 3 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
161+
TEST 4 dm-stripe step 3 - Verify sysfs atomic_write_unit_max_bytes = expected_atomic_write_unit_max - pass
162+
TEST 5 dm-stripe step 3 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
163+
TEST 6 dm-stripe step 3 - Verify statx stx_atomic_write_unit_min - pass
164+
TEST 7 dm-stripe step 3 - Verify statx stx_atomic_write_unit_max - pass
165+
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
166+
pwrite: Invalid argument
167+
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
168+
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
169+
pwrite: Invalid argument
170+
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
171+
TEST 1 dm-stripe step 4 - Verify md sysfs atomic attributes matches - pass
172+
TEST 2 dm-stripe step 4 - Verify sysfs atomic attributes - pass
173+
TEST 3 dm-stripe step 4 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
174+
TEST 4 dm-stripe step 4 - Verify sysfs atomic_write_unit_max_bytes = expected_atomic_write_unit_max - pass
175+
TEST 5 dm-stripe step 4 - Verify sysfs atomic_write_unit_boundary_bytes = expected atomic_write_unit_boundary_bytes - pass
176+
TEST 6 dm-stripe step 4 - Verify statx stx_atomic_write_unit_min - pass
177+
TEST 7 dm-stripe step 4 - Verify statx stx_atomic_write_unit_max - pass
178+
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
179+
pwrite: Invalid argument
180+
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
181+
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
182+
pwrite: Invalid argument
183+
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
132184
Test complete

tests/md/003

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ requires() {
1818

1919
device_requires() {
2020
_require_test_dev_is_nvme
21+
_require_test_dev_size 5m
2122
}
2223

2324
test_device_array() {

tests/md/rc

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ _md_atomics_test() {
157157
raw_atomic_write_boundary=0;
158158
fi
159159

160-
for personality in raid0 raid1 raid10 dm-linear; do
160+
161+
for personality in raid0 raid1 raid10 dm-linear dm-stripe; do
161162
local step_limit
162-
if [ "$personality" = raid0 ] || [ "$personality" = raid10 ]
163+
if [ "$personality" = raid0 ] || [ "$personality" = raid10 ] || \
164+
[ "$personality" = dm-stripe ]
163165
then
164166
step_limit=4
165167
else
@@ -225,7 +227,7 @@ _md_atomics_test() {
225227
md_dev=$(readlink /dev/md/blktests_md | sed 's|\.\./||')
226228
fi
227229

228-
if [ "$personality" = dm-linear ]
230+
if [ "$personality" = dm-linear ] || [ "$personality" = dm-stripe ]
229231
then
230232
for i in "${MD_DEVICES[@]}"; do
231233
pvremove --force /dev/"$i" 2> /dev/null 1>&2
@@ -236,6 +238,25 @@ _md_atomics_test() {
236238
/dev/"${dev2}" /dev/"${dev3}" 2> /dev/null 1>&2
237239
fi
238240

241+
if [ "$personality" = dm-stripe ]
242+
then
243+
atomics_boundaries_unit_max=$(_md_atomics_boundaries_max "$raw_atomic_write_boundary" $md_chunk_size "1")
244+
atomics_boundaries_max=$(_md_atomics_boundaries_max "$raw_atomic_write_boundary" $md_chunk_size "0")
245+
246+
# The caller should ensure test device size, we ask for a total of 10M
247+
# So each should be at least (10M + meta) / 4 in size, so 5 each should be enough
248+
echo y | lvm lvcreate --stripes 4 --stripesize "${md_chunk_size_kb}" -L 10M \
249+
-n blktests_lv blktests_vg00 2> /dev/null 1>&2
250+
md_dev=$(readlink /dev/mapper/blktests_vg00-blktests_lv | sed 's|\.\./||')
251+
expected_atomic_write_unit_min=$(_min "$expected_atomic_write_unit_min" "$atomics_boundaries_unit_max")
252+
expected_atomic_write_unit_max=$(_min "$expected_atomic_write_unit_max" "$atomics_boundaries_unit_max")
253+
expected_atomic_write_max=$(_min "$expected_atomic_write_max" "$atomics_boundaries_max")
254+
if [ "$atomics_boundaries_max" -eq 0 ]
255+
then
256+
expected_atomic_write_boundary=0
257+
fi
258+
fi
259+
239260
if [ "$personality" = dm-linear ]
240261
then
241262
local vgsize
@@ -416,7 +437,7 @@ _md_atomics_test() {
416437
done
417438
fi
418439

419-
if [ "$personality" = dm-linear ]
440+
if [ "$personality" = dm-linear ] || [ "$personality" = dm-stripe ]
420441
then
421442
lvremove --force /dev/mapper/blktests_vg00-blktests_lv 2> /dev/null 1>&2
422443
vgremove --force blktests_vg00 2> /dev/null 1>&2

0 commit comments

Comments
 (0)