Skip to content

Commit

Permalink
common/rc: introduce _io_uring_enable/_io_uring_restore
Browse files Browse the repository at this point in the history
block/035 and ublk tests need to run with io_uring enabled, add two
common functions to use for the tests

Link: #153
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
  • Loading branch information
yizhanglinux authored and kawasaki committed Dec 20, 2024
1 parent ce767b4 commit 6f3ad75
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions common/rc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ shopt -s extglob
. common/cgroup
. common/dm

declare IO_URING_DISABLED

# If a test runs multiple "subtests", then each subtest should typically run
# for TIMEOUT / number of subtests.
_divide_timeout() {
Expand Down Expand Up @@ -550,3 +552,21 @@ _check_conflict_and_set_default()

eval "${new_name_checked}=true"
}

_io_uring_enable()
{
# enable io_uring when it is disabled
IO_URING_DISABLED=0
if [ -f /proc/sys/kernel/io_uring_disabled ]; then
IO_URING_DISABLED=$(cat /proc/sys/kernel/io_uring_disabled)
if [ "$IO_URING_DISABLED" != 0 ]; then
echo 0 > /proc/sys/kernel/io_uring_disabled
fi
fi
}
_io_uring_restore()
{
if [ "$IO_URING_DISABLED" != 0 ]; then
echo "$IO_URING_DISABLED" > /proc/sys/kernel/io_uring_disabled
fi
}

0 comments on commit 6f3ad75

Please # to comment.