From patchwork Wed Aug 15 20:37:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10566835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF2321875 for ; Wed, 15 Aug 2018 20:37:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ECC42AFBA for ; Wed, 15 Aug 2018 20:37:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92D6E2B000; Wed, 15 Aug 2018 20:37:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D961F2B006 for ; Wed, 15 Aug 2018 20:37:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbeHOXbZ (ORCPT ); Wed, 15 Aug 2018 19:31:25 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:23654 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727126AbeHOXbY (ORCPT ); Wed, 15 Aug 2018 19:31:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1534365461; x=1565901461; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TuiapgstU2LtfqILL+2yY6hsSXtYDd8yeVsg2AzoPJs=; b=J6agtSloZnuNy4lya0A36fW1wCqdZUVcOTd65Zm8mOlGJXSs+YlB/uhd GVI/gBietwU474qkSmJzhg+TJ1TvIfVSTU1LRCYSD3ACnBwMXQiXIbiuW hwyha7tpOrJXxVSA4CHeedb5/dFPmSXtz4M4FI7Jci5DDaq7sjFPgQ2HA zM4FzGU427ASdIn3Ij7IG6I6lR8PpikADk7EQabC8SwQ6kIUV+H/9dO3x 4PJDI0MYdUxkH9/R1ADtvr1BciszxsUlL82HGsY/bzAJloj2sUI1QDnCe qPIoxrrb6HMpXMpXMlQTYWUDmDDZL8p57ZlBGcowJ5KUWnASETfK6Y0tl g==; X-IronPort-AV: E=Sophos;i="5.53,244,1531756800"; d="scan'208";a="191631623" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2018 04:37:29 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 15 Aug 2018 13:24:52 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2018 13:37:29 -0700 From: Bart Van Assche To: Omar Sandoval Cc: Mike Snitzer , Johannes Thumshirn , linux-block@vger.kernel.org, Bart Van Assche Subject: [PATCH blktests 1/3] tests/srp: Remove unused code Date: Wed, 15 Aug 2018 13:37:26 -0700 Message-Id: <20180815203728.19521-2-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180815203728.19521-1-bart.vanassche@wdc.com> References: <20180815203728.19521-1-bart.vanassche@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove all code that depends on $nvme != "" and also the $nvme variable itself. Signed-off-by: Bart Van Assche --- tests/srp/001 | 19 +---- tests/srp/002 | 2 +- tests/srp/003 | 2 +- tests/srp/004 | 2 +- tests/srp/011 | 2 +- tests/srp/rc | 223 +++++--------------------------------------------- 6 files changed, 24 insertions(+), 226 deletions(-) diff --git a/tests/srp/001 b/tests/srp/001 index 7dee21334a82..3a40348436af 100755 --- a/tests/srp/001 +++ b/tests/srp/001 @@ -22,7 +22,7 @@ DESCRIPTION="Create and remove LUNs" QUICK=1 # Count the number of LUNs created by start_srpt() from the initiator side. -count_srp_luns() { +count_luns() { local h luns=0 p for p in /sys/class/srp_remote_ports/*; do @@ -36,23 +36,6 @@ count_srp_luns() { echo $luns } -count_nvme_devs() { - local d devs=0 - - for d in /sys/class/nvme-fabrics/ctl/*/*/device; do - [ -d "$d" ] && ((devs++)) - done - echo $devs -} - -count_luns() { - if [ -n "$nvme" ]; then - count_nvme_devs - else - count_srp_luns - fi -} - wait_for_luns() { local i luns diff --git a/tests/srp/002 b/tests/srp/002 index 74c5feec7570..de1cf58df63c 100755 --- a/tests/srp/002 +++ b/tests/srp/002 @@ -40,7 +40,7 @@ test_disconnect_repeatedly() { >>"$FULL" fio_status=$? wait - [ -z "$nvme" ] && log_in + log_in return $fio_status } diff --git a/tests/srp/003 b/tests/srp/003 index 9b8eeb4f4122..58e3247ac2a7 100755 --- a/tests/srp/003 +++ b/tests/srp/003 @@ -40,7 +40,7 @@ test_disconnect_repeatedly() { >>"$FULL" fio_status=$? wait - [ -z "$nvme" ] && log_in + log_in return $fio_status } diff --git a/tests/srp/004 b/tests/srp/004 index 1e8766a3276e..d362fd94776e 100755 --- a/tests/srp/004 +++ b/tests/srp/004 @@ -40,7 +40,7 @@ test_disconnect_repeatedly() { --output="${RESULTS_DIR}/srp/fio-output-004.txt" >>"$FULL" fio_status=$? wait - [ -z "$nvme" ] && log_in + log_in return $fio_status } diff --git a/tests/srp/011 b/tests/srp/011 index df99da5e9e96..64b6aa5dcf8e 100755 --- a/tests/srp/011 +++ b/tests/srp/011 @@ -36,7 +36,7 @@ test_disconnect_repeatedly() { >>"$FULL" fio_status=$? wait - [ -z "$nvme" ] && log_in + log_in return $fio_status } diff --git a/tests/srp/rc b/tests/srp/rc index 61ac65ec59c6..7484b9513252 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -31,9 +31,6 @@ debug= elevator=none filesystem_type=ext4 fio_aux_path=/tmp/fio-state-files -nvme= -nvme_subsysnqn="nvme-test" -nvme_port=7777 scsi_timeout=1 srp_login_params= srp_rdma_cm_port=5555 @@ -137,8 +134,8 @@ use_blk_mq() { log_out && remove_mpath_devs && - stop_client && - start_client indirect_sg_entries=2048 "${kmod_params[@]}" && + stop_srp_ini && + start_srp_ini indirect_sg_entries=2048 "${kmod_params[@]}" && log_in } @@ -238,9 +235,9 @@ show_srp_connections() { } # Make the SRP initiator driver log in to each SRP target port that exists -# on the local host. $1 are additional SRP login parameters. -srp_log_in() { - local a add_param=$1 d dest gid ibdev ioc_guid port p sysfsdir +# on the local host. +log_in() { + local a add_param="${srp_login_params}" d dest gid ibdev ioc_guid port p sysfsdir ioc_guid=$( /dev/nvme-fabrics - fi - done && - echo reconfigure | multipathd -k >&/dev/null -} - -nvme_log_out() { - local c - - for c in /sys/class/nvme-fabrics/ctl/*/delete_controller; do - [ -e "$c" ] && echo 1 > "$c" & - done - wait -} - -# Log in. -log_in() { - if [ -n "$nvme" ]; then - nvme_log_in - else - srp_log_in "${srp_login_params}" - fi -} - -log_out() { - if [ -n "$nvme" ]; then - nvme_log_out - else - srp_log_out - fi -} - # Check whether any stacked block device holds block device $1. If so, echo # the name of the holder. held_by() { @@ -416,17 +374,11 @@ simulate_network_failure_loop() { s=5 while [ $rc = 0 ]; do sleep_until 5 ${deadline} || break - if [ -n "$nvme" ]; then - for d in $(held_by "$dev"); do - echo 1 >"$d/device/reset_controller" - done - else - log_out - sleep_until $s ${deadline} - rc=$? - s=$(((((s + 5) & 0xff) ^ 0xa6) * scsi_timeout / 60)) - log_in - fi + log_out + sleep_until $s ${deadline} + rc=$? + s=$(((((s + 5) & 0xff) ^ 0xa6) * scsi_timeout / 60)) + log_in done for ((i=0;i<5;i++)); do @@ -608,26 +560,8 @@ remove_srp_mpath_devs() { } &>> "$FULL" } -remove_nvme_mpath_devs() { - local dm h - - for h in /sys/class/block/nvme*/holders/*; do - [ -e "$h" ] || continue - d=$(basename "$(dirname "$(dirname "$h")")") - dm=/dev/$(basename "$h") - { - echo -n "NVME dev $d: removing $dm: " - dmsetup remove "$(dev_to_mpath "$dm")" && echo "done" - } &>> "$FULL" - done -} - remove_mpath_devs() { - if [ -n "$nvme" ]; then - remove_nvme_mpath_devs - else - remove_srp_mpath_devs - fi + remove_srp_mpath_devs } # Arguments: module to unload ($1) and retry count ($2). @@ -644,16 +578,16 @@ unload_module() { } # Load the SRP initiator driver with kernel module parameters $1..$n. -start_srp() { +start_srp_ini() { modprobe scsi_transport_srp || return $? modprobe ib_srp "$@" dyndbg=+pmf || return $? } # Unload the SRP initiator driver. -stop_srp() { +stop_srp_ini() { local i - srp_log_out + log_out for ((i=40;i>=0;i--)); do remove_mpath_devs || return $? unload_module ib_srp >/dev/null 2>&1 && break @@ -666,35 +600,6 @@ stop_srp() { unload_module scsi_transport_srp || return $? } -start_nvme_client() { - modprobe nvme dyndbg=+pmf && - modprobe nvme-core dyndbg=+pmf && - modprobe nvme-fabrics dyndbg=+pmf && - modprobe nvme-rdma dyndbg=+pmf -} - -stop_nvme_client() { - unload_module nvme_rdma && - unload_module nvme -} - -# Load the initiator kernel driver with kernel module parameters $1..$n. -start_client() { - if [ -n "$nvme" ]; then - start_nvme_client "$@" - else - start_srp "$@" - fi -} - -stop_client() { - if [ -n "$nvme" ]; then - stop_nvme_client - else - stop_srp - fi -} - # Load the configfs kernel module and mount it. mount_configfs() { if [ ! -e /sys/module/configfs ]; then @@ -775,14 +680,7 @@ get_bdev_uid() { local i=$1 is_number "$i" || return $? - if [ -n "$nvme" ]; then - bdev=$(get_nvme_bdev "$i") || return $? - wwid=$(<"/sys/block/${bdev#/dev/}/wwid") - wwid=${wwid#nvme.0000-} - echo "${wwid%-4c696e75780000000000000000000000000000000000000000000000000000000000000000000000-00000001}" - else - scsi_mpath_id "$i" - fi + scsi_mpath_id "$i" } # Set scheduler of block device $1 to $2. @@ -1127,81 +1025,6 @@ stop_srpt() { unload_module scsi_debug } -configure_nvmet_port() { - local p=$1 ipv4_addr=$2 i - - echo "Configuring $p with address $ipv4_addr as an NVMeOF target port" \ - >>"$FULL" - ( - cd /sys/kernel/config/nvmet/ports && - for ((i=1;1;i++)); do [ -e "$i" ] || break; done && - mkdir "$i" && - cd "$i" && - echo ipv4 > addr_adrfam && - echo rdma > addr_trtype && - echo -n "$ipv4_addr" > addr_traddr && - echo -n ${nvme_port} > addr_trsvcid - ) -} - -start_nvme_target() { - local d i ipv4_addr num_ports=0 nvme_dev=1 - - if have_brd; then - modprobe brd rd_nr=${#vdev_path[@]} rd_size=$((ramdisk_size>>10)) - fi && - modprobe nvme dyndbg=+pmf && - modprobe nvmet-rdma dyndbg=+pmf && - sleep .1 && - ( - cd /sys/kernel/config/nvmet/subsystems && - mkdir ${nvme_subsysnqn} && - cd ${nvme_subsysnqn} && - cd namespaces && - mkdir "${nvme_dev}" && - cd "${nvme_dev}" && - echo 00000000-0000-0000-0000-000000000000 >device_nguid && - echo -n /dev/ram0 >device_path && - echo 1 >enable && - cd ../.. && - echo 1 >attr_allow_any_host - ) && for i in $(rdma_network_interfaces); do - ipv4_addr=$(get_ipv4_addr "$i") - if [ -n "${ipv4_addr}" ]; then - configure_nvmet_port "$i" "${ipv4_addr}" - ((num_ports++)) - true - fi - done && - if [ $num_ports = 0 ]; then - echo "No NVMeOF target ports" - false - fi && ( - cd /sys/kernel/config/nvmet/ports && - for i in *; do - [ -e "$i" ] && ( - cd "$i/subsystems" && - ln -s "../../../subsystems/${nvme_subsysnqn}" . - ) - done - ) -} - -stop_nvme_target() { - local d - - ( - cd /sys/kernel/config/nvmet 2>/dev/null && - rm -f -- ports/*/subsystems/* && - for d in {*/*/*/*,*/*}; do - [ -e "$d" ] && rmdir "$d" - done - ) - unload_module nvmet_rdma && - unload_module nvmet && - have_brd && unload_module brd -} - start_target() { start_rdma_rxe ( @@ -1214,19 +1037,11 @@ start_target() { done done ) &>>"$FULL" - if [ -n "$nvme" ]; then - start_nvme_target - else - start_srpt - fi + start_srpt } stop_target() { - if [ -n "$nvme" ]; then - stop_nvme_target - else - stop_srpt - fi + stop_srpt stop_rdma_rxe || return $? } @@ -1381,7 +1196,7 @@ unload_null_blk() { shutdown_client() { remove_mpath_devs && log_out && - stop_client + stop_srp_ini } # Undo setup()