From: Bart Van Assche Date: Sat, 28 Mar 2020 18:22:49 +0000 (-0700) Subject: Use _{init,exit}_null_blk instead of open-coding these functions X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c07a34181a352845e519b5a6ef3c8789ffcbcda2;p=users%2Fhch%2Fblktests.git Use _{init,exit}_null_blk instead of open-coding these functions This patch reduces code duplication. Reviewed-by: Chaitanya Kulkarni Reviewed-by: Daniel Wagner Signed-off-by: Bart Van Assche --- diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index 40efc4b..a56e7a8 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 1fd6314..136163b 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() {