Skip to content

Commit 2530e14

Browse files
committed
zbd/090: Add a SCSI test for npo2 zone sizes
Signed-off-by: Bart Van Assche <[email protected]>
1 parent 49c0d02 commit 2530e14

File tree

3 files changed

+71
-5
lines changed

3 files changed

+71
-5
lines changed

common/scsi_debug

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ _have_scsi_debug() {
1111
SD_PARAM_PATH=/sys/module/scsi_debug/parameters
1212
SD_PSEUDO_PATH=/sys/bus/pseudo/drivers/scsi_debug
1313

14-
# shellcheck disable=SC2317 # Don't warn about unreachable commands in this function
15-
_have_scsi_debug_group_number_stats() {
14+
# Test whether the scsi_debug driver supports zone sizes that are not a power
15+
# of two.
16+
_have_scsi_debug_npo2() {
1617
modprobe -r scsi_debug >&/dev/null
17-
if modprobe scsi_debug delay=0 >&/dev/null &&
18-
[[ -e /sys/bus/pseudo/drivers/scsi_debug/group_number_stats ]]
18+
if modprobe scsi_debug delay=0 zbc=host-managed zone_size_mb=3 >&/dev/null &&
19+
[[ -e /sys/bus/pseudo/drivers/scsi_debug/adapter0 ]]
1920
then
2021
modprobe -r scsi_debug >&/dev/null
2122
return 0
2223
fi
23-
SKIP_REASONS+=("scsi_debug does not support group number statistics")
24+
SKIP_REASONS+=("scsi_debug does not support npo2 zone sizes")
2425
modprobe -r scsi_debug >&/dev/null
2526
return 1
2627
}

tests/zbd/090

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0+
3+
# Copyright (C) 2023 Google LLC
4+
5+
. tests/zbd/rc
6+
. common/null_blk
7+
. common/scsi_debug
8+
9+
DESCRIPTION="test npo2 zone size support"
10+
QUICK=1
11+
12+
requires() {
13+
_have_fio
14+
_have_module_param scsi_debug zone_size_mb
15+
_have_scsi_debug_npo2
16+
}
17+
18+
test() {
19+
echo "Running ${TEST_NAME}" >>"$FULL"
20+
echo "Running ${TEST_NAME}"
21+
22+
local fail
23+
local scsi_debug_params=(
24+
delay=0
25+
dev_size_mb=1024
26+
sector_size=4096
27+
zbc=host-managed
28+
zone_nr_conv=0
29+
zone_size_mb=3
30+
)
31+
_init_scsi_debug "${scsi_debug_params[@]}" &&
32+
local zdev="${SCSI_DEBUG_DEVICES[0]}" &&
33+
local zpath="/dev/${zdev}" &&
34+
ls -ld "${zpath}" >>"${FULL}" &&
35+
head -n9 /sys/class/block/"${zdev}"/queue/{chunk_sectors,nr_zones} >>"${FULL}" &&
36+
local fio_args=(
37+
--direct=1
38+
--filename="${zpath}"
39+
--gtod_reduce=1
40+
--ioengine=pvsync
41+
--ioscheduler=none
42+
--name=npo2zs
43+
--runtime=10
44+
--rw=randwrite
45+
--time_based=1
46+
--verify=crc32c
47+
--verify_state_save=0
48+
--zonemode=zbd
49+
) &&
50+
fio "${fio_args[@]}" >>"${FULL}" 2>&1 ||
51+
fail=true
52+
53+
rm -f ./local-*-verify.state
54+
55+
_exit_scsi_debug
56+
57+
if [ -z "$fail" ]; then
58+
echo "Test complete"
59+
else
60+
echo "Test failed"
61+
return 1
62+
fi
63+
}

tests/zbd/090.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Running zbd/090
2+
Test complete

0 commit comments

Comments
 (0)