blob: 80a5f99b08ca1c813b74623e4d5d08ac590aaa48 [file] [log] [blame] [edit]
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0+
# Copyright (C) 2017 Jens Axboe
#
# I/O polling helper functions.
. common/shellcheck
_have_fio_with_poll() {
if ! _have_fio; then
return 1
fi
if ! fio --parse-only --name=test --ioengine=pvsync2 --hipri=1 1>/dev/null 2>&1; then
SKIP_REASON="Fio does not support polling"
return 1
fi
return 0
}
_test_dev_supports_io_poll() {
local old_io_poll
if ! old_io_poll="$(cat "${TEST_DEV_SYSFS}/queue/io_poll" 2>/dev/null)"; then
SKIP_REASON="kernel does not support polling"
return 1
fi
if ! echo "$old_io_poll" >"${TEST_DEV_SYSFS}/queue/io_poll" 2>/dev/null; then
SKIP_REASON="$TEST_DEV does not support polling"
return 1
fi
return 0
}
_test_dev_supports_io_poll_delay() {
local old_io_poll_delay
if ! old_io_poll_delay="$(cat "${TEST_DEV_SYSFS}/queue/io_poll_delay" 2>/dev/null)"; then
SKIP_REASON="kernel does not support hybrid polling"
return 1
fi
if ! echo "$old_io_poll_delay" >"${TEST_DEV_SYSFS}/queue/io_poll_delay" 2>/dev/null; then
SKIP_REASON="$TEST_DEV does not support hybrid polling"
return 1
fi
return 0
}