Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Use fio zbd zonemode when testing SMR drives #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion tests/scripts/test_lib
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ function dev_capacity()
fi
}

function dev_number_of_zones()
{
local dev="$(realpath $1)"
local bdev="$(basename ${dev})"
local bdev_nr_zones="/sys/block/${bdev}/queue/nr_zones"

if [ -f "${bdev_nr_zones}" ]; then
echo "$(cat ${bdev_nr_zones})"
else
echo "0"
fi
}

function dev_fw()
{
local dev="$(realpath $1)"
Expand Down Expand Up @@ -750,6 +763,10 @@ function fio_common_cmdline()

fi

if [ "$(devtype ${dev})" == "smr" ]; then
fiocmd+=" --zonemode=zbd"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this only is far from enough because the drive may actually have absolutely nothing to read if all zones are empty and we have no conventional zones. If the drive has conventional zones, then read tests will endup reading only the tiny conventional zones LBA range which will not generate enough seek overhead to get a correct results for most tests that rely on failed IOs due to the IO time limits being exceeded. So we need preconditioning of the SMR drive by filling zones before starting the tests. E.g. filling up 1 zone every 100 zone should be enough.

fi

fiocmd+=" 2>&1"

echo $fiocmd
Expand All @@ -762,6 +779,7 @@ function analyze_log()
local compare_latencies="$3"
local cdl_dld="$4"
local rw="$5"
local dev="$6"
local real_runtime
local max_runtime

Expand All @@ -783,6 +801,14 @@ function analyze_log()
# that are expected to run the whole run time.
max_runtime=$((max_runtime + 2))

# Add additional buffer time on top of the max time if SMR drives are
# used, as fio takes extra time to get zone info on zoned block devices.
# Overhead is estimated to be around 1 second per 25000 zones.
if [ "$(devtype ${dev})" == "smr" ]; then
local zone_overhead=$(( $(dev_number_of_zones ${dev}) / 25000 + 1 ))
max_runtime=$((max_runtime + zone_overhead))
fi

# If fio ran longer than max_runtime, then most likely an I/O timed out
# and the HBA had to be hard reset. This would suggest a FW issue.
# This check tries to catch such cases, so that we don't accidentally
Expand Down Expand Up @@ -1022,7 +1048,7 @@ function execute_test()
{ enable_merges "${dev}"; exit_failed "running fio failed"; }

analyze_log "${fiolog}" "${expect_error}" \
"${compare_latencies}" "${cdl_dld}" "${rw}" || \
"${compare_latencies}" "${cdl_dld}" "${rw}" "${dev}" || \
exit_failed "error while analyzing fio log"

if [ "${stats}" != "" ]; then
Expand Down