]> www.infradead.org Git - users/hch/blktests.git/commitdiff
Use _{init,exit}_null_blk instead of open-coding these functions
authorBart Van Assche <bvanassche@acm.org>
Sat, 28 Mar 2020 18:22:49 +0000 (11:22 -0700)
committerOmar Sandoval <osandov@fb.com>
Wed, 8 Apr 2020 21:49:59 +0000 (14:49 -0700)
This patch reduces code duplication.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
common/multipath-over-rdma
tests/nvmeof-mp/rc

index 40efc4b3aa2eccb64a183995059d06cd05ca79c8..a56e7a8269db60c152cb50435710171128283978 100644 (file)
@@ -5,6 +5,7 @@
 # Functions and global variables used by both the srp and nvmeof-mp tests.
 
 . common/shellcheck
+. common/null_blk
 
 debug=
 filesystem_type=ext4
@@ -634,13 +635,6 @@ configure_null_blk() {
        ls -l /dev/nullb* &>>"$FULL"
 }
 
-unload_null_blk() {
-       local d
-
-       for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done
-       unload_module null_blk
-}
-
 setup_rdma() {
        start_soft_rdma
        (
@@ -662,7 +656,7 @@ teardown_uncond() {
        rm -f /etc/multipath.conf
        stop_target
        stop_soft_rdma
-       unload_null_blk
+       _exit_null_blk
 }
 
 teardown() {
@@ -698,7 +692,7 @@ setup_test() {
                [ -e "/sys/module/$m" ] || modprobe "$m" || return $?
        done
 
-       modprobe null_blk nr_devices=0 || return $?
+       _init_null_blk nr_devices=0 || return $?
 
        configure_null_blk || return $?
 
index 1fd63144592103924dcf87d0e1b473843be96428..136163bc73adc307dc7b5c066cd9175647eeb4ef 100755 (executable)
@@ -278,7 +278,7 @@ stop_nvme_target() {
        )
        unload_module nvmet_rdma &&
                unload_module nvmet &&
-               unload_null_blk
+               _exit_null_blk
 }
 
 start_target() {