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