diff mbox series

[blktests,v2,03/16] common: Move set_scheduler() function definition

Message ID 20190110093725.32675-4-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Implement zoned block device support | expand

Commit Message

Shin'ichiro Kawasaki Jan. 10, 2019, 9:37 a.m. UTC
set_scheduler() function defined in common/multipath-over-rdma is useful
to set up a specific IO scheduler not only for multipath tests but also
for zoned block device tests. Move this function to common/rc to allow
its use in test groups other than multipath.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/multipath-over-rdma | 24 ------------------------
 common/rc                  | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

Comments

Omar Sandoval Jan. 17, 2019, 2:18 a.m. UTC | #1
On Thu, Jan 10, 2019 at 06:37:12PM +0900, Shin'ichiro Kawasaki wrote:
> set_scheduler() function defined in common/multipath-over-rdma is useful
> to set up a specific IO scheduler not only for multipath tests but also
> for zoned block device tests. Move this function to common/rc to allow
> its use in test groups other than multipath.

The preferred way to set the scheduler is:

_test_dev_queue_set scheduler "$scheduler"

This function is in the multipath tests because it was a preexisting
test suite which was merged into blktests.

> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  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 e628f96..0b99e84 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -222,3 +222,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
>
Shin'ichiro Kawasaki Jan. 17, 2019, 6:18 a.m. UTC | #2
On 1/17/19 11:18 AM, Omar Sandoval wrote:
> On Thu, Jan 10, 2019 at 06:37:12PM +0900, Shin'ichiro Kawasaki wrote:
>> set_scheduler() function defined in common/multipath-over-rdma is useful
>> to set up a specific IO scheduler not only for multipath tests but also
>> for zoned block device tests. Move this function to common/rc to allow
>> its use in test groups other than multipath.
> 
> The preferred way to set the scheduler is:
> 
> _test_dev_queue_set scheduler "$scheduler"
> 
> This function is in the multipath tests because it was a preexisting
> test suite which was merged into blktests.

OK. Will use _test_dev_queue_set instead.
diff mbox series

Patch

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 e628f96..0b99e84 100644
--- a/common/rc
+++ b/common/rc
@@ -222,3 +222,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
+}