xref: /linux/tools/testing/selftests/ublk/test_stress_03.sh (revision 6f7e6393d1ce636bb7ec77a7fe7b77458fddf701)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
5ERR_CODE=0
6
7ublk_io_and_remove()
8{
9	run_io_and_remove "$@"
10	ERR_CODE=$?
11	if [ ${ERR_CODE} -ne 0 ]; then
12		echo "$TID failure: $*"
13		_show_result $TID $ERR_CODE
14	fi
15}
16
17if ! _have_program fio; then
18	exit "$UBLK_SKIP_CODE"
19fi
20
21if ! _have_feature "ZERO_COPY"; then
22	exit "$UBLK_SKIP_CODE"
23fi
24
25_prep_test "stress" "run IO and remove device(zero copy)"
26
27_create_backfile 0 256M
28_create_backfile 1 128M
29_create_backfile 2 128M
30
31ublk_io_and_remove 8G -t null -q 4 -z &
32ublk_io_and_remove 256M -t loop -q 4 -z "${UBLK_BACKFILES[0]}" &
33ublk_io_and_remove 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
34wait
35
36if _have_feature "AUTO_BUF_REG"; then
37	ublk_io_and_remove 8G -t null -q 4 --auto_zc &
38	ublk_io_and_remove 256M -t loop -q 4 --auto_zc "${UBLK_BACKFILES[0]}" &
39	ublk_io_and_remove 256M -t stripe -q 4 --auto_zc "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
40	ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback &
41	wait
42fi
43
44if _have_feature "PER_IO_DAEMON"; then
45	ublk_io_and_remove 8G -t null -q 4 --auto_zc --nthreads 8 --per_io_tasks &
46	ublk_io_and_remove 256M -t loop -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
47	ublk_io_and_remove 256M -t stripe -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
48	ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback --nthreads 8 --per_io_tasks &
49	wait
50fi
51
52_cleanup_test "stress"
53_show_result $TID $ERR_CODE
54