diff mbox series

[v3,6/7] common: move module_unload to common

Message ID 20200811210102.194287-7-sagi@grimberg.me (mailing list archive)
State New, archived
Headers show
Series blktests: Add support to run nvme tests with tcp/rdma transports | expand

Commit Message

Sagi Grimberg Aug. 11, 2020, 9:01 p.m. UTC
It creates a dependency between multipath-over-rdma
and test/nvmeof/rc which is not a natural home
for it. Move it to common helpers.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 common/rc          | 13 +++++++++++++
 tests/nvmeof-mp/rc | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

Comments

Bart Van Assche Aug. 11, 2020, 9:30 p.m. UTC | #1
On 2020-08-11 14:01, Sagi Grimberg wrote:
> It creates a dependency between multipath-over-rdma
> and test/nvmeof/rc which is not a natural home
> for it. Move it to common helpers.
> 
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>  common/rc          | 13 +++++++++++++
>  tests/nvmeof-mp/rc | 13 -------------
>  2 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 7f02103dc786..cdc0150ea5ea 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -291,3 +291,16 @@ _filter_xfs_io_error() {
>  _uptime_s() {
>  	awk '{ print int($1) }' /proc/uptime
>  }
> +
> +# Arguments: module to unload ($1) and retry count ($2).
> +unload_module() {
> +	local i m=$1 rc=${2:-1}
> +
> +	[ ! -e "/sys/module/$m" ] && return 0
> +	for ((i=rc;i>0;i--)); do
> +		modprobe -r "$m"
> +		[ ! -e "/sys/module/$m" ] && return 0
> +		sleep .1
> +	done
> +	return 1
> +}
> diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc
> index e446db297ba1..829b26624b7f 100755
> --- a/tests/nvmeof-mp/rc
> +++ b/tests/nvmeof-mp/rc
> @@ -145,19 +145,6 @@ remove_mpath_devs() {
>  	} &>> "$FULL"
>  }
>  
> -# Arguments: module to unload ($1) and retry count ($2).
> -unload_module() {
> -	local i m=$1 rc=${2:-1}
> -
> -	[ ! -e "/sys/module/$m" ] && return 0
> -	for ((i=rc;i>0;i--)); do
> -		modprobe -r "$m"
> -		[ ! -e "/sys/module/$m" ] && return 0
> -		sleep .1
> -	done
> -	return 1
> -}
> -
>  start_nvme_client() {
>  	modprobe nvme-core dyndbg=+pmf &&
>  		modprobe nvme dyndbg=+pmf &&
> 

Hi Sagi,

I think there is another copy of unload_module() in tests/srp/rc. How about
also removing that copy?

Thanks,

Bart.
Sagi Grimberg Aug. 11, 2020, 9:45 p.m. UTC | #2
> Hi Sagi,
> 
> I think there is another copy of unload_module() in tests/srp/rc. How about
> also removing that copy?

Yes, this is minor enough to remove when applying, Or I can respin the
patch set again if Omar prefers it that way.
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 7f02103dc786..cdc0150ea5ea 100644
--- a/common/rc
+++ b/common/rc
@@ -291,3 +291,16 @@  _filter_xfs_io_error() {
 _uptime_s() {
 	awk '{ print int($1) }' /proc/uptime
 }
+
+# Arguments: module to unload ($1) and retry count ($2).
+unload_module() {
+	local i m=$1 rc=${2:-1}
+
+	[ ! -e "/sys/module/$m" ] && return 0
+	for ((i=rc;i>0;i--)); do
+		modprobe -r "$m"
+		[ ! -e "/sys/module/$m" ] && return 0
+		sleep .1
+	done
+	return 1
+}
diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc
index e446db297ba1..829b26624b7f 100755
--- a/tests/nvmeof-mp/rc
+++ b/tests/nvmeof-mp/rc
@@ -145,19 +145,6 @@  remove_mpath_devs() {
 	} &>> "$FULL"
 }
 
-# Arguments: module to unload ($1) and retry count ($2).
-unload_module() {
-	local i m=$1 rc=${2:-1}
-
-	[ ! -e "/sys/module/$m" ] && return 0
-	for ((i=rc;i>0;i--)); do
-		modprobe -r "$m"
-		[ ! -e "/sys/module/$m" ] && return 0
-		sleep .1
-	done
-	return 1
-}
-
 start_nvme_client() {
 	modprobe nvme-core dyndbg=+pmf &&
 		modprobe nvme dyndbg=+pmf &&