This patch reduces code duplication. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- common/multipath-over-rdma | 12 +++--------- tests/nvmeof-mp/rc | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index 40efc4b3aa2e..a56e7a8269db 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -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 $? diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index 1fd631445921..136163bc73ad 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -278,7 +278,7 @@ stop_nvme_target() { ) unload_module nvmet_rdma && unload_module nvmet && - unload_null_blk + _exit_null_blk } start_target() {