From: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> set_scheduler() function defined in common/multipath-over-rdma is useful to set up specific IO scheduler not only for multipath tests but also for zoned block device tests. Move the function to common/rc to reuse it for test groups other than multipath. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- common/multipath-over-rdma | 24 ------------------------ common/rc | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index 308c9b5..6bea8e4 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -275,30 +275,6 @@ mount_configfs() { fi } -# Set scheduler of block device $1 to $2. -set_scheduler() { - local b=$1 p s=$2 - - p=/sys/class/block/$b/queue/scheduler - if [ -e "/sys/block/$b/mq" ]; then - case "$s" in - noop) s=none;; - deadline) s=mq-deadline;; - bfq) s=bfq;; - esac - else - case "$s" in - none) s=noop;; - mq-deadline) s=deadline;; - bfq-mq) s=bfq;; - esac - fi - if ! echo "$s" > "$p"; then - echo "Changing scheduler of $b from $(<"$p") into $s failed" - return 1 - fi -} - # Get a /dev/... path that points at dm device number $1. Set its I/O scheduler # to $2 and its timeout to $3. The shell script that includes this file must # define a function get_bdev_path() that translates device number $1 into a diff --git a/common/rc b/common/rc index 999590d..85f6468 100644 --- a/common/rc +++ b/common/rc @@ -223,3 +223,27 @@ _test_dev_is_zoned() { fi return 0 } + +# Set scheduler of block device $1 to $2. +set_scheduler() { + local b=$1 p s=$2 + + p=/sys/class/block/$b/queue/scheduler + if [ -e "/sys/block/$b/mq" ]; then + case "$s" in + noop) s=none;; + deadline) s=mq-deadline;; + bfq) s=bfq;; + esac + else + case "$s" in + none) s=noop;; + mq-deadline) s=deadline;; + bfq-mq) s=bfq;; + esac + fi + if ! echo "$s" > "$p"; then + echo "Changing scheduler of $b from $(<"$p") into $s failed" + return 1 + fi +} -- 2.20.1