From patchwork Thu Jan 10 09:37:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755437 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 29B4B1399 for ; Thu, 10 Jan 2019 09:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 193E6292A2 for ; Thu, 10 Jan 2019 09:37:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D290292D3; Thu, 10 Jan 2019 09:37:36 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9DB89292A2 for ; Thu, 10 Jan 2019 09:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727866AbfAJJhf (ORCPT ); Thu, 10 Jan 2019 04:37:35 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25528 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbfAJJhf (ORCPT ); Thu, 10 Jan 2019 04:37:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113087; x=1578649087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pnt7Qxkqse0S6ZxSKQ/QFG4UwJwscYzQnINFv9SFMMk=; b=A22RF7HgV0SRq2ivAUczihSZ4YJT1BScDaNmqbQN8c2FuksetR3CbK3v 1Ar8kxoSTI5skzkbShWodVFlKd+m0tNceurDRngC0UZNHYKkFcwPEYdha ZgafA7O8h5cplxF/bY2VUz/SQFhrg5exfazdiGQaibv1n48Wt9oMO0doI qHtFPMptqgCWQX3jj7qlbkHIt6SJPc5maCd4mrPBJcrW5bKf5TttVgBLl plfhfZYtjru9qFrud2Tzq0cY22c1SCB63RCZwETJS+qOHzymLdiS33StE KR0YN5TkSAeShntQ5DJAl5nbkRfRypsWBBTr5WmjXlxEGSV7SIa2R8Db2 A==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468967" 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; 10 Jan 2019 17:38:07 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:05 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:31 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 01/16] config: Introduce ZONED variable Date: Thu, 10 Jan 2019 18:37:10 +0900 Message-Id: <20190110093725.32675-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 To allow running tests against null_blk devices with the zoned mode enabled, introduce the config ZONED variable. If set (ZONED=1), tests that create a null_blk device as a test target device will be executed against a zoned null device. _init_null_blk is modified to prepare null_blk as a zoned blocked device if ZONED is set. To avoid "modprobe -r null_blk" failures, rmdir calls on all sysfs nullbX directories is added. Introduce a helper function _null_blk_not_zoned() to check if _init_null_blk() creates zoned device or not. This function can be used within test script implementation of the requires() function to ensure that the test is run only for non-zoned null_blk device. The use of the ZONED variable requires that the kernel be compiled with CONFIG_BLK_DEV_ZONED enabled. Signed-off-by: Shin'ichiro Kawasaki --- Documentation/running-tests.md | 11 +++++++++++ check | 1 + common/null_blk | 23 ++++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Documentation/running-tests.md b/Documentation/running-tests.md index 8f32af3..0416d6d 100644 --- a/Documentation/running-tests.md +++ b/Documentation/running-tests.md @@ -82,6 +82,17 @@ passing the `-d` command line option or setting the `DEVICE_ONLY` variable. DEVICE_ONLY=1 ``` +### Zoned Block Device + +Some test items prepare virtual devices such as null_blk. To configure the +virtual device as a zoned block device, set `ZONED` variable. The use of the +ZONED variable requires that the kernel be compiled with CONFIG_BLK_DEV_ZONED +enabled. + +```sh +ZONED=1 +``` + ### Custom Setup The `config` file is really just a bash file that is sourced at the beginning diff --git a/check b/check index 6c6d9f5..141ebb6 100755 --- a/check +++ b/check @@ -591,6 +591,7 @@ fi # Default configuration. : "${DEVICE_ONLY:=0}" : "${QUICK_RUN:=0}" +: "${ZONED:=0}" : "${OUTPUT:=results}" if [[ -v EXCLUDE ]] && ! declare -p EXCLUDE | grep -q '^declare -a'; then # If EXCLUDE was not defined as an array, convert it to one. diff --git a/common/null_blk b/common/null_blk index 937ece0..a78c95d 100644 --- a/common/null_blk +++ b/common/null_blk @@ -8,8 +8,29 @@ _have_null_blk() { _have_modules null_blk } +_null_blk_not_zoned() { + if [[ "${ZONED}" != "0" ]]; then + # shellcheck disable=SC2034 + SKIP_REASON="null_blk zoned mode not supported" + return 1 + fi + return 0 +} + _init_null_blk() { - if ! modprobe -r null_blk || ! modprobe null_blk "$@"; then + for d in /sys/kernel/config/nullb/*; + do [[ -d "$d" ]] && rmdir "$d"; done + + local _zoned="" + if [[ ${ZONED} -ne 0 ]] ; then + if ! _have_kernel_option BLK_DEV_ZONED ; then + echo -n "ZONED specified for kernel with " + echo "CONFIG_BLK_DEV_ZONED disabled" + return 1 + fi + _zoned="zoned=1" + fi + if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${_zoned}" ; then return 1 fi From patchwork Thu Jan 10 09:37:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755439 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 83E0D1515 for ; Thu, 10 Jan 2019 09:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74CBC29296 for ; Thu, 10 Jan 2019 09:37:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6960E292D6; Thu, 10 Jan 2019 09:37:40 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 09BE7292CD for ; Thu, 10 Jan 2019 09:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727893AbfAJJhj (ORCPT ); Thu, 10 Jan 2019 04:37:39 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25539 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbfAJJhj (ORCPT ); Thu, 10 Jan 2019 04:37:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113094; x=1578649094; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=f5JJMNF36dAu/M7VQo3QuCwldHftUiXhavgL1sNL/hY=; b=EN26hE7oYP8wIyobCnTVAj9FwuAMAoPtdi3MqbH0A8+/h1k+ZpgobUYv KN7bWgVXTxPBvC86kJERHolzJ25Yd2kO820Gu7QEHsXt31bcTtpaL8eB+ h7yiHOj2FisTlNWAuK3VzFvRwwdH0diGKTTC3qAVp/gIfd2O1O1mIqbYT PaMoae/8XKNkYbnxQ2WKouGL1UbW5fROPZU8jDJ4p3RptCnxL2LmNpEzd bHjqfyBiZmIKyKOR8R9ZZExYeHTkNyMbZvN4mO82dLTu/HDcLknfb7jUT OaKh/JgdJzM0dPML6MWq+sg+XIkL/NobPj/vDv9yYEJ2ItcmqqAPXjEcV Q==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468974" 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; 10 Jan 2019 17:38:13 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:09 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:35 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 02/16] common: Introduce _test_dev_is_zoned() helper function Date: Thu, 10 Jan 2019 18:37:11 +0900 Message-Id: <20190110093725.32675-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 Introduce the helper function _test_dev_is_zoned() to check if a test device is a zoned block device. Using this function, test scripts can adjust test conditions based on the device zone model. This function can also be used within test scripts implementation of the device_requires() function to ensure that the test is run only for zoned block device or only for non-zoned block device. Signed-off-by: Shin'ichiro Kawasaki --- common/rc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/rc b/common/rc index 153a323..e628f96 100644 --- a/common/rc +++ b/common/rc @@ -214,3 +214,11 @@ _test_dev_in_hotplug_slot() { _filter_xfs_io_error() { sed -e 's/^\(.*\)64\(: .*$\)/\1\2/' } + +_test_dev_is_zoned() { + if grep -qe "none" "${TEST_DEV_SYSFS}/queue/zoned" ; then + SKIP_REASON="${TEST_DEV} is not a zoned block device" + return 1 + fi + return 0 +} From patchwork Thu Jan 10 09:37:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755441 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 25A891515 for ; Thu, 10 Jan 2019 09:37:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16BA4286DC for ; Thu, 10 Jan 2019 09:37:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ACEB2929E; Thu, 10 Jan 2019 09:37:44 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A94ED286DC for ; Thu, 10 Jan 2019 09:37:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727900AbfAJJhn (ORCPT ); Thu, 10 Jan 2019 04:37:43 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25539 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbfAJJhn (ORCPT ); Thu, 10 Jan 2019 04:37:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113100; x=1578649100; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VkM8mcqCoPUhPptDLmEbCYbmAZtaGQ2y3SVflzTHfiQ=; b=ibem4mrv9m9FIoJiTlnqBoOAH6HLCSrhxVoCP4fhQ/UmsXzaQySAaQ9r lZi3eB7Ha9boMFabraELxezl8NQNAVXsKopf/aXkFKGUqojVGRoAzGZw1 lFiBm0+DoOR631yG8czoYr7YRSEV0GDSCgNxeL0my/suiLARgUWFVmHyS kT3WOfajuedmELvMXcvNhWGuGAWTO0PFLgPwXaNVctW5NMgScIacQ58rX IDzOeiq0orT/V1XkR3QVspzi6Rb28vQiFQk0mF4EkjTC12xaRnNkOD3zm J6/ld/1fSj6BLVty1zrPEt2v/2xN4hCSbLQkmrDZEc1+lwtZUczgM4vKp Q==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468976" 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; 10 Jan 2019 17:38:19 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:13 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:39 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 03/16] common: Move set_scheduler() function definition Date: Thu, 10 Jan 2019 18:37:12 +0900 Message-Id: <20190110093725.32675-4-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 set_scheduler() function defined in common/multipath-over-rdma is useful to set up a specific IO scheduler not only for multipath tests but also for zoned block device tests. Move this function to common/rc to allow its use in test groups other than multipath. Signed-off-by: Shin'ichiro Kawasaki --- common/multipath-over-rdma | 24 ------------------------ common/rc | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index 308c9b5..6bea8e4 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -275,30 +275,6 @@ mount_configfs() { fi } -# Set scheduler of block device $1 to $2. -set_scheduler() { - local b=$1 p s=$2 - - p=/sys/class/block/$b/queue/scheduler - if [ -e "/sys/block/$b/mq" ]; then - case "$s" in - noop) s=none;; - deadline) s=mq-deadline;; - bfq) s=bfq;; - esac - else - case "$s" in - none) s=noop;; - mq-deadline) s=deadline;; - bfq-mq) s=bfq;; - esac - fi - if ! echo "$s" > "$p"; then - echo "Changing scheduler of $b from $(<"$p") into $s failed" - return 1 - fi -} - # Get a /dev/... path that points at dm device number $1. Set its I/O scheduler # to $2 and its timeout to $3. The shell script that includes this file must # define a function get_bdev_path() that translates device number $1 into a diff --git a/common/rc b/common/rc index e628f96..0b99e84 100644 --- a/common/rc +++ b/common/rc @@ -222,3 +222,27 @@ _test_dev_is_zoned() { fi return 0 } + +# Set scheduler of block device $1 to $2. +set_scheduler() { + local b=$1 p s=$2 + + p=/sys/class/block/$b/queue/scheduler + if [ -e "/sys/block/$b/mq" ]; then + case "$s" in + noop) s=none;; + deadline) s=mq-deadline;; + bfq) s=bfq;; + esac + else + case "$s" in + none) s=noop;; + mq-deadline) s=deadline;; + bfq-mq) s=bfq;; + esac + fi + if ! echo "$s" > "$p"; then + echo "Changing scheduler of $b from $(<"$p") into $s failed" + return 1 + fi +} From patchwork Thu Jan 10 09:37:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755443 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 769D51399 for ; Thu, 10 Jan 2019 09:37:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6997F292DE for ; Thu, 10 Jan 2019 09:37:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E119292A8; Thu, 10 Jan 2019 09:37:49 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C5565292D1 for ; Thu, 10 Jan 2019 09:37:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbfAJJhr (ORCPT ); Thu, 10 Jan 2019 04:37:47 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25551 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbfAJJhr (ORCPT ); Thu, 10 Jan 2019 04:37:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113106; x=1578649106; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m8TUMuU0WrSV2cObnHoEtD5GaIIGOGegE+ezFeuOKDE=; b=cWuVeDFAQVEmFAXuUm+a9VHCe37VWQ+agTC3ZklOwIN0E0Fb9w2XzpgD Y61lxByGKZmIOXnizxRjnwMSXgbV07Lo/exCkUbOJvrxPC3hkos3C2mXk 8muAeCRn5wN5beNAiQr4jXuJd6+KiZZaNNTv5+oEyV4MGNtlj0dhlGQmU 7oT8m92WAtclZatZ8YVlrWznni4kt48y1XsTAkV39qnmrHih6A4sOgvNE MyV8GpH+bUa4nurDzZK2mIpVkgDPwcRVGK7emJGmLfxgPWAx4A+BCgCzx g0Zw+1CgqAE5vU1SrsATPVa0RsICFXQRpCm+RhtY4WKd0MqjmsmlLr9H3 g==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468978" 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; 10 Jan 2019 17:38:25 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:17 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:43 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 04/16] common: Introduce _have_fio_zbd_zonemode() helper function Date: Thu, 10 Jan 2019 18:37:13 +0900 Message-Id: <20190110093725.32675-5-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 Fio zbd zone mode is necessary for zoned block devices. Introduce the helper function _have_fio_zbd_zonemode() to check that the installed fio version supports the option --zonemode=zbd. Signed-off-by: Shin'ichiro Kawasaki --- common/fio | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/fio b/common/fio index e407088..44d9c86 100644 --- a/common/fio +++ b/common/fio @@ -17,6 +17,18 @@ _have_fio() { return 0 } +_have_fio_zbd_zonemode() { + local -a v + + _have_fio || return $? + mapfile -t v < <(fio --version | tr -s -c "[:digit:]" "\n") + if [[ ${v[1]} -lt 3 || ( ${v[1]} -eq 3 && ${v[2]} -lt 9 ) ]]; then + SKIP_REASON="Fio version too old (does not support --zonemode=zbd)" + return 1 + fi + return 0 +} + declare -A FIO_TERSE_FIELDS FIO_TERSE_FIELDS=( # Read status From patchwork Thu Jan 10 09:37:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755445 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 F1E3A1515 for ; Thu, 10 Jan 2019 09:38:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E402C292E0 for ; Thu, 10 Jan 2019 09:38:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8693292E3; Thu, 10 Jan 2019 09:38:04 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C1E6A292D2 for ; Thu, 10 Jan 2019 09:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727916AbfAJJiD (ORCPT ); Thu, 10 Jan 2019 04:38:03 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25557 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbfAJJiD (ORCPT ); Thu, 10 Jan 2019 04:38:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113084; x=1578649084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CyXgBxFofyFjmYAYzW1/Ngl99UpQOlz5CAC4EPQ/P1g=; b=eHDj17Qh1qb2y2mskIDYUpu2/bRoe3lZeoCSHFJ3NTf2xs2ZpWM/+YF4 Iy0q+KaVMZuXC7Dbk5S/yb85w/PkyufdcEGYzNSzEEjZq2FmGECTOFUaZ mOrAeTsQLe71jTspwfw6HWR4QXpgNNqCpKgbTbMeWoAdOaPQ+QPe3p4qv ZHezu5MIoCQIVkn9R6TqZ7gtZDih9tkBaU8nRXK7jVkjNy27AWjDLqVBQ zUk6CRRjXXe8b8UjSuXIOc4yZlSkFAtEQ3NH1naeYySbdTmRrK/AeO6oW ZaO9RkVx2YH/ZMoWtG08oB/DHqENyuYh4aF1laSF9+XJ0pw7FlNzrOZUu g==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468980" 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; 10 Jan 2019 17:38:32 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:21 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:47 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 05/16] block/004: Adjust fio conditions for zoned block device Date: Thu, 10 Jan 2019 18:37:14 +0900 Message-Id: <20190110093725.32675-6-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 For a random write pattern to a zoned block device, fio requires --direct=1 and --zonemode=zbd options as well as deadline I/O scheduler to be specified. Specify these options and set the I/O scheduler if the target device is a zoned block device. Before doing that, also make sure that the deadline scheduler is available and that fio supports the zbd zone mode. Signed-off-by: Shin'ichiro Kawasaki --- tests/block/004 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/block/004 b/tests/block/004 index 4c14c4b..88cc083 100755 --- a/tests/block/004 +++ b/tests/block/004 @@ -16,10 +16,26 @@ requires() { test_device() { echo "Running ${TEST_NAME}" + local directio="" + local zbdmode="" + + if _test_dev_is_zoned; then + if ! _have_fio_zbd_zonemode; then + echo "${SKIP_REASON}" + return 1 + fi + + set_scheduler "$(basename "$(readlink -f "${TEST_DEV}")")" \ + deadline || return $? + + directio="--direct=1" + zbdmode="--zonemode=zbd" + fi + FIO_PERF_FIELDS=("write iops") _fio_perf --bs=4k --rw=randwrite --norandommap --fsync=1 \ --number_ios=256 --numjobs=64 --name=flushes \ - --filename="$TEST_DEV" + ${directio} ${zbdmode} --filename="$TEST_DEV" echo "Test complete" } From patchwork Thu Jan 10 09:37:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755447 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 39BB51708 for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B00229296 for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F60C292DA; Thu, 10 Jan 2019 09:38:05 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 CE0BE292D9 for ; Thu, 10 Jan 2019 09:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbfAJJiE (ORCPT ); Thu, 10 Jan 2019 04:38:04 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25557 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727906AbfAJJiD (ORCPT ); Thu, 10 Jan 2019 04:38:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113085; x=1578649085; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3OQcsi1yU0ByuSqzlqVyi/FGyGBLmv2+IEHJohsWTFI=; b=gjgiOQYhb572DxrAvNFFeswe8i1W8sdWnMtfNfuLS95Wu2A0U6sXG4/B FQAUgVRcAOgqGRuSAw81RG9ZRoptTQPoA3wTwcIKtSvJk5rkXnt5lomE9 qhAszeq4UIr6oAQL2epohw67r7MkoQpqAXjC6UAjFknepf518pMR+kl9O BfXLuN4d31ORYs7/s20vEuhwOLBgWNHwznTefeLktMEqSPUAC2zZVVlfL BmkOe+/pTKQ+iBPBBYINOHAmrF01CiSjx4YGcCMkAUydze4F8WSQeIJE1 s/ns7Kan1DZpeAhxatnRbNH2kUcC86fPl0Owww53cQbv4/r6weVlS12/x Q==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468981" 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; 10 Jan 2019 17:38:38 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:25 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:51 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 06/16] block/013: Skip for zoned block devices Date: Thu, 10 Jan 2019 18:37:15 +0900 Message-Id: <20190110093725.32675-7-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 block/013 runs mkfs.ext3 but ext3 file system does not support zoned block devices. Add device_requires() implementation to automatically skip the test if the target device is a zoned block device. Signed-off-by: Shin'ichiro Kawasaki --- tests/block/013 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/block/013 b/tests/block/013 index 35fc181..35998c7 100755 --- a/tests/block/013 +++ b/tests/block/013 @@ -19,6 +19,15 @@ requires() { _have_program mkfs.ext3 } +device_requires() { + if _test_dev_is_zoned; then + SKIP_REASON="${TEST_DEV} is a zoned block device " + SKIP_REASON+="(not supported by ext3)" + return 1 + fi + return 0 +} + test_device() { echo "Running ${TEST_NAME}" From patchwork Thu Jan 10 09:37:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755449 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 6FB0B1399 for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 626F129296 for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 565C7292D3; Thu, 10 Jan 2019 09:38:05 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 03C8A292D2 for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbfAJJiE (ORCPT ); Thu, 10 Jan 2019 04:38:04 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25557 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbfAJJiE (ORCPT ); Thu, 10 Jan 2019 04:38:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113086; x=1578649086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NWBGjS2c3O5GeVg7/WntRTuwCdCNJ7t0rStpgraWiQE=; b=opR81UvaS+oqpVLZ3r1EtcoszYrtIg45pxBiPWPtLWCnXi/N25vpbw+K 8yjY2oCIh1HOYgOQ41utM9USIfTZWamYmNDMZKo16o7vMAd/RjuUrbGL+ RdIL1g5e4HQSGz6CEoKviIbyST4PoBqWp5dtOJTVYoMsNJnHABRoNVNib MQkohR2wGbzRLz4uA8Vv90PML949lPp15752lMHU4WBGHp/Y+8hVlpNEA MxcON3hzS900VsnIYnGkMNR1/QuH1Rl8K1cdUhNpnu0A6/+PA1f4c9o3U YVmt7pvDJew5o8V7puyO/8oG0TpPluBg7FckHeeYnN2AHc/U2gK6TnRNC w==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468984" 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; 10 Jan 2019 17:38:44 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:30 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:37:56 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 07/16] block/018,024: Skip when ZONED is set Date: Thu, 10 Jan 2019 18:37:16 +0900 Message-Id: <20190110093725.32675-8-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 These tests do not execute a purely sequential write pattern which will cause I/O failures when ZONED is set and null_blk is created with zoned mode. Skip the tests in such case. Signed-off-by: Shin'ichiro Kawasaki --- tests/block/018 | 2 +- tests/block/024 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/block/018 b/tests/block/018 index 7312723..3c1eca4 100755 --- a/tests/block/018 +++ b/tests/block/018 @@ -11,7 +11,7 @@ DESCRIPTION="do I/O and check iostats times" QUICK=1 requires() { - _have_null_blk + _have_null_blk && _null_blk_not_zoned } init_times() { diff --git a/tests/block/024 b/tests/block/024 index cf14707..c8dd1f7 100755 --- a/tests/block/024 +++ b/tests/block/024 @@ -13,7 +13,7 @@ DESCRIPTION="do I/O faster than a jiffy and check iostats times" QUICK=1 requires() { - _have_null_blk + _have_null_blk && _null_blk_not_zoned } init_times() { From patchwork Thu Jan 10 09:37:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755451 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 AC7E717FB for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E2C5292CD for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91D97292D3; Thu, 10 Jan 2019 09:38:05 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 32464292D9 for ; Thu, 10 Jan 2019 09:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfAJJiE (ORCPT ); Thu, 10 Jan 2019 04:38:04 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25562 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727934AbfAJJiE (ORCPT ); Thu, 10 Jan 2019 04:38:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113086; x=1578649086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nkqv/ycijaqi1SgvdSnleRcBm5gIb4Cr9XrVnPiS8D8=; b=XO75WRSMat1lUMfsaEhS67nduEGUC+8E+L/8GcEeZowVw0ATDn5phVxq NyKFwqhKwAM6bLqwr3Wdu61/TFTOFtOidEoKR6/4MeByq3nO3PIWC0RIA qQLXyFCcZBYdKZ8nbbGRt99VT+nSW5D2Catn7OZjyJEWjBq7cjpQViz+7 ReA1d0Cf+CQ/Yoy4JOlIQfOO5yaqjydSwJ+JlOyVxFRQakwcksbLNEO+o o8HMOzu5QxjlWj0yHzIx9zRLRG4p2RZn5ZgXcw+j9jZMvTIBQfIhPGISv M6CHHBY4+ysFYfI/RaEildpWZ7SCbBWXp5SS+KqXYPCX1UYiJEH03nYy9 g==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468995" 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; 10 Jan 2019 17:38:06 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:34 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:00 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 08/16] check: Introduce group_exit() function Date: Thu, 10 Jan 2019 18:37:17 +0900 Message-Id: <20190110093725.32675-9-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 This optional function can be defined by a test group rc script. When defined, it is executed after all tests of the group complete, allowing cleaning up resources used by all tests of the group. Signed-off-by: Shin'ichiro Kawasaki --- check | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/check b/check index 141ebb6..360f61b 100755 --- a/check +++ b/check @@ -467,6 +467,11 @@ _run_group() { ret=1 fi done + + if declare -fF group_exit >/dev/null ; then + group_exit + fi + return $ret } From patchwork Thu Jan 10 09:37:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755453 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 B9AF31515 for ; Thu, 10 Jan 2019 09:38:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB4C5292A2 for ; Thu, 10 Jan 2019 09:38:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DF6F292BD; Thu, 10 Jan 2019 09:38:08 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 41437292DA for ; Thu, 10 Jan 2019 09:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727956AbfAJJiH (ORCPT ); Thu, 10 Jan 2019 04:38:07 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25565 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727934AbfAJJiH (ORCPT ); Thu, 10 Jan 2019 04:38:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113091; x=1578649091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z8Pb2zTInRMN1PR/pXA6dcbSKZE+cS0z7wrOF+mM2Po=; b=ZuAy79YyDEtfvrawvpEvNhYwscJylNL8Iqqfac90Uf6t4aFiNG8IY2Vx lZVOD/XDnP8zohRwFs0r9RTTKIUtj9n+htyfyDGh+3EGwjucN0umuPyxm WgwcyAyofdmYaJ0v2HD/AD9ZrXN64UTNlIK346qhs2hJmYF8IHUkg3veZ 1cc2TIIBc6Qybppy4ke0TcHYnLoMkKvLHZJCec7J2UNyWpzm5Rbl8m+Vg nVF8fwHVhv29qa+gIcsKUr8zZkvpCNdJaOtx6tOxTkqawS39O1bfJhC8d QsyDW4BvK/aETiHzqVPqes+w7aNIX4bV/3sVAhojWe3xjzt7yYxXULAuW w==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196468997" 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; 10 Jan 2019 17:38:10 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:38 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:04 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 09/16] src: Introduce zbdioctl program Date: Thu, 10 Jan 2019 18:37:18 +0900 Message-Id: <20190110093725.32675-10-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 zbdioctl implements calls to zoned block devices ioctls that are not supported currently by sys-utils blkzone utility, namely BLKGETZONESZ and BLKGETNRZONES. Signed-off-by: Shin'ichiro Kawasaki --- src/.gitignore | 1 + src/Makefile | 3 +- src/zbdioctl.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/zbdioctl.c diff --git a/src/.gitignore b/src/.gitignore index 8c95785..2108f56 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -6,3 +6,4 @@ /nbdsetsize /sg/dxfer-from-dev /sg/syzkaller1 +/zbdioctl diff --git a/src/Makefile b/src/Makefile index c4094b4..5a0556f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,7 +5,8 @@ C_TARGETS := \ sg/dxfer-from-dev \ sg/syzkaller1 \ nbdsetsize \ - loop_change_fd + loop_change_fd \ + zbdioctl CXX_TARGETS := \ discontiguous-io diff --git a/src/zbdioctl.c b/src/zbdioctl.c new file mode 100644 index 0000000..1ea72e8 --- /dev/null +++ b/src/zbdioctl.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-3.0+ +// Copyright (C) 2018 Western Digital Corporation or its affiliates. +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(BLKGETZONESZ) || !defined(BLKGETNRZONES) + +int main(int argc, char **argv) +{ + return EXIT_FAILURE; +} + +#else + +struct request { + const char *name; + unsigned long code; +} requests[] = { + { "-s", BLKGETZONESZ}, + { "-n", BLKGETNRZONES}, + { NULL, 0}, +}; + +void usage(const char *progname) +{ + int i = 0; + + fprintf(stderr, "usage: %s \n", progname); + fprintf(stderr, " can be:\n"); + while (requests[i].name) { + fprintf(stderr, "\t%s\n", requests[i].name); + i++; + } + exit(EXIT_FAILURE); +} + +int main(int argc, char **argv) +{ + int i = 0, fd, ret; + unsigned int val; + unsigned long code = 0; + + if (argc != 3) + usage(argv[0]); + + while (requests[i].name) { + if (strcmp(argv[1], requests[i].name) == 0) { + code = requests[i].code; + break; + } + i++; + } + if (code == 0) + usage(argv[0]); + + fd = open(argv[2], O_RDWR); + if (fd < 0) { + perror("open"); + return EXIT_FAILURE; + } + + ret = ioctl(fd, code, &val); + if (ret < 0) { + perror("ioctl"); + close(fd); + return EXIT_FAILURE; + } + + printf("%u\n", val); + + close(fd); + + return EXIT_SUCCESS; +} + +#endif + From patchwork Thu Jan 10 09:37:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755455 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 C01EE1515 for ; Thu, 10 Jan 2019 09:38:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2614292D3 for ; Thu, 10 Jan 2019 09:38:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6D7C292D4; Thu, 10 Jan 2019 09:38:12 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 568CF292A8 for ; Thu, 10 Jan 2019 09:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727882AbfAJJiL (ORCPT ); Thu, 10 Jan 2019 04:38:11 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25576 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbfAJJiL (ORCPT ); Thu, 10 Jan 2019 04:38:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113097; x=1578649097; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jVwSaPPGPxBy8T2rj8Y+/TioJuCb2a9sAlKrvvDZMcQ=; b=LqQ3M1/+R5oR8o2jGitebuC70UAELSXg/Qt9ct+Q87YB5piwwgOJQhHc wqdFSX/FwYuV88i76mJwmv47TbmV+2klkdI6F/0V+A6GRrSsy5Y/obHGf 1i8cuL7Ou897WNVjSk0ua6ubr1SdIgRrutavB5Z1N5Dem+h1km6whpGye auZ/nWhQ10h+K2cNem+H9DcdxFVNFPmgvVxcfTkCsixxHIG3mgj8hfUF+ 9QEh8FGhgss+P3iekyQ9YzNlrBm5U/ZgMEu9TiAXlRzj/t/aSvnfJu7+s rT8Knxc0BVnt9sGbwLBXHb7JZrJRmGzzV52xYzGM780+zONg49p8wxXvK g==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="196469022" 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; 10 Jan 2019 17:38:16 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:42 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:08 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 10/16] common: Introduce _dd() helper function Date: Thu, 10 Jan 2019 18:37:19 +0900 Message-Id: <20190110093725.32675-11-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 To analyze dd command failures found by blktests, need to confirm dd command options. Introduce the helper function which executes dd and records dd command options in FULL file for quick analysis. Signed-off-by: Shin'ichiro Kawasaki --- common/rc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/common/rc b/common/rc index 0b99e84..190e450 100644 --- a/common/rc +++ b/common/rc @@ -246,3 +246,34 @@ set_scheduler() { return 1 fi } + +# Issue dd command with five arguments and record command line in FULL file. +# args: target device, r/w, start sector, sector len, block size in bytes +_dd() { + local target_dev=${1} + local rw=${2} + local -i start_sector=${3} + local -i start_byte=$(( start_sector * 512 )) + local -i sector_count=${4} + local -i bs=${5} + local -i block_count=$(( sector_count * 512 / bs )) + + local _cmd="dd bs=${bs} count=${block_count}" + + if [[ ${rw} = "read" ]]; then + _cmd="${_cmd} if=${target_dev} of=/dev/null" + _cmd="${_cmd} iflag=skip_bytes skip=${start_byte}" + elif [[ ${rw} = "write" ]]; then + _cmd="${_cmd} if=/dev/zero of=${target_dev}" + _cmd="${_cmd} oflag=seek_bytes,direct seek=${start_byte}" + fi + + echo "${_cmd}" >> "$FULL" 2>&1 + + if ! eval "${_cmd}" >> "$FULL" 2>&1 ; then + echo "dd command failed" + return 1 + fi + + sync +} From patchwork Thu Jan 10 09:37:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755457 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 59ADB1399 for ; Thu, 10 Jan 2019 09:38:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49262292D2 for ; Thu, 10 Jan 2019 09:38:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DA98292D4; Thu, 10 Jan 2019 09:38:25 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 89BC1292BD for ; Thu, 10 Jan 2019 09:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727868AbfAJJiY (ORCPT ); Thu, 10 Jan 2019 04:38:24 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16282 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbfAJJiX (ORCPT ); Thu, 10 Jan 2019 04:38:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113104; x=1578649104; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D0kLPT+HCsxdgiItaYFS2rsC6DVeH0hABJYkRTR4zoo=; b=jNHZIXfS9GsjHpmVI4Tks3rCZ5R9S4HZ5fzQTLhTJ1ibdPqtYxNsKj6M 54FBubdcNCJvHPy/v3rX4j71fTLeBkbb0DTLIbfrWo5docMn+ZF3Gai90 K/8/096280a9cHzH0Jg5YJnZAkaG8CXJntakeqfkwNWsxu5Jxcn/WNZ5m S77hUN44+/1hlrZ9/xNo8zxB0la/FNdLtOq2uu8B0OfpxAXSaN2px8Q95 EBCGbw9Gc3VYfg76DP0PxE7qGMkhVJhH5H8CLA3pztRg5oH1AecV3hl1U Jv5cRfsW+hits1RwvY8A8ws5tl9Dj7HLqqarSmY3dk8tbMMtg7dp8uzyE A==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="100223360" 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; 10 Jan 2019 17:38:24 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:54 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:20 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 11/16] tests: Introduce zbd test group Date: Thu, 10 Jan 2019 18:37:20 +0900 Message-Id: <20190110093725.32675-12-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 From: Masato Suzuki The zoned block device (zbd) test group is used to gather all tests specific to zoned block devices (null_blk device with zoned mode enabled, SMR disks, dm-linear on top of zoned devices, etc). Execution of this group requires that the kernel be compiled with the block layer CONFIG_BLK_DEV_ZONED option enabled and also requires the null_blk driver to have zoned mode support (added in kernel 4.19). This group rc script allows all tests to operate even if TEST_DEVS is not set in the config. If TEST_DEVS is not set, the rc script creates a null_blk device with zoned mode enabled and the created device assigned to TEST_DEVS. If TEST_DEVS is set, all tests are executed against the specified devices, which all must be zoned. With this, all tests scripts can be written by only defining the test_device() function while allowing operation on both nullblk and user specified devices. Signed-off-by: Shin'ichiro Kawasaki Signed-off-by: Masato Suzuki --- tests/zbd/rc | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 tests/zbd/rc diff --git a/tests/zbd/rc b/tests/zbd/rc new file mode 100644 index 0000000..207a7f3 --- /dev/null +++ b/tests/zbd/rc @@ -0,0 +1,219 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Western Digital Corporation or its affiliates. +# +# Tests for Zone Block Device. + +. common/rc +. common/null_blk + +# +# Test requirement check functions +# + +group_requires() { + _have_root || return $? + _have_program blkzone || return $? + _have_program dd || return $? + _have_kernel_option BLK_DEV_ZONED || return $? + _have_modules null_blk && _have_module_param null_blk zoned + + # If TEST_DEVS is set in config file, use it as is. + # Otherwise, create a zoned null_blk device and set TEST_DEVS. + if [[ -n "${TEST_DEVS}" ]] ; then + return 0 + fi + + local test_dev + local sysfs_dir + if ! _init_null_blk zone_size=4 gb=1 zoned=1 ; then + return 1 + fi + test_dev=/dev/nullb0 + if ! sysfs_dir="$(_find_sysfs_dir "$test_dev")"; then + _error "could not find sysfs directory for ${test_dev}" + return 1 + fi + _NULL_BLK_ZONED_CREATED=1 + TEST_DEVS+=( "${test_dev}" ) + + # shellcheck disable=SC2034 + TEST_DEV_SYSFS_DIRS["$test_dev"]="$sysfs_dir" + + return 0 +} + +group_device_requires() { + _test_dev_is_zoned +} + +group_exit() { + if [[ -n "${_NULL_BLK_ZONED_CREATED}" ]] ; then + _exit_null_blk + unset _NULL_BLK_ZONED_CREATED + fi +} + +# +# Zone types and conditions +# +export ZONE_TYPE_CONVENTIONAL=1 +export ZONE_TYPE_SEQ_WRITE_REQUIRED=2 +export ZONE_TYPE_SEQ_WRITE_PREFERRED=3 + +export ZONE_COND_EMPTY=1 +export ZONE_COND_IMPLICIT_OPEN=2 +export ZONE_COND_FULL=14 + +export ZONE_TYPE_ARRAY=( + [1]="CONVENTIONAL" + [2]="SEQ_WRITE_REQUIRED" + [3]="SEQ_WRITE_PREFERRED" +) + +export ZONE_COND_ARRAY=( + [0]="NOT_WP" + [1]="EMPTY" + [2]="IMPLICIT_OPEN" + [3]="EXPLICIT_OPEN" + [4]="CLOSE" + [13]="READ_ONLY" + [14]="FULL" + [15]="OFFLINE" +) + +# sysfs variable array indices +export SV_CAPACITY=0 +export SV_CHUNK_SECTORS=1 +export SV_PHYS_BLK_SIZE=2 +export SV_PHYS_BLK_SECTORS=3 +export SV_NR_ZONES=4 + +# +# Helper functions +# + +# Obtain zone related sysfs variables and keep in a global array until put +# function call. +_get_sysfs_variable() { + unset SYSFS_VARS + local _dir=${TEST_DEV_SYSFS} + SYSFS_VARS[$SV_CAPACITY]=$(<"${_dir}"/size) + SYSFS_VARS[$SV_CHUNK_SECTORS]=$(<"${_dir}"/queue/chunk_sectors) + SYSFS_VARS[$SV_PHYS_BLK_SIZE]=$(<"${_dir}"/queue/physical_block_size) + SYSFS_VARS[$SV_PHYS_BLK_SECTORS]=$((SYSFS_VARS[SV_PHYS_BLK_SIZE] / 512)) + + # If the nr_zones sysfs attribute exists, get its value. Otherwise, + # calculate its value based on the total capacity and zone size, taking + # into account that the last zone can be smaller than other zones. + if [[ -e ${TEST_DEV_SYSFS}/queue/nr_zones ]]; then + SYSFS_VARS[$SV_NR_ZONES]=$(<"${_dir}"/queue/nr_zones) + else + SYSFS_VARS[$SV_NR_ZONES]=$(( (SYSFS_VARS[SV_CAPACITY] - 1) \ + / SYSFS_VARS[SV_CHUNK_SECTORS] + 1 )) + fi +} + +_put_sysfs_variable() { + unset SYSFS_VARS +} + +# Issue zone report command and keep reported information in global arrays +# until put function call. +_get_blkzone_report() { + local target_dev=${1} + + # Initialize arrays to store parsed blkzone reports. + # Number of reported zones is set in REPORTED_COUNT. + # The arrays have REPORTED_COUNT+1 elements with additional one at tail + # to simplify loop operation. + ZONE_STARTS=() + ZONE_LENGTHS=() + ZONE_WPTRS=() + ZONE_CONDS=() + ZONE_TYPES=() + NR_CONV_ZONES=0 + REPORTED_COUNT=0 + + TMP_REPORT_FILE=${TMPDIR}/blkzone_report + if ! blkzone report "${target_dev}" > "${TMP_REPORT_FILE}"; then + echo "blkzone command failed" + return $? + fi + + local _IFS=$IFS + local -i loop=0 + IFS=$' ,:' + while read -r -a _tokens + do + ZONE_STARTS+=($((_tokens[1]))) + ZONE_LENGTHS+=($((_tokens[3]))) + ZONE_WPTRS+=($((_tokens[5]))) + ZONE_CONDS+=($((${_tokens[11]%\(*}))) + ZONE_TYPES+=($((${_tokens[13]%\(*}))) + if [[ ${ZONE_TYPES[-1]} -eq ${ZONE_TYPE_CONVENTIONAL} ]]; then + (( NR_CONV_ZONES++ )) + fi + (( loop++ )) + done < "${TMP_REPORT_FILE}" + IFS="$_IFS" + REPORTED_COUNT=${loop} + + if [[ ${REPORTED_COUNT} -eq 0 ]] ; then + echo "blkzone report returned no zone" + return 1 + fi + + # Set value to allow additioanl element access at array end + local -i max_idx=$((REPORTED_COUNT - 1)) + ZONE_STARTS+=( $((ZONE_STARTS[max_idx] + ZONE_LENGTHS[max_idx])) ) + ZONE_LENGTHS+=( "${ZONE_LENGTHS[max_idx]}" ) + ZONE_WPTRS+=( "${ZONE_WPTRS[max_idx]}" ) + ZONE_CONDS+=( "${ZONE_CONDS[max_idx]}" ) + ZONE_TYPES+=( "${ZONE_TYPES[max_idx]}" ) + + rm -f "${TMP_REPORT_FILE}" +} + +_put_blkzone_report() { + unset ZONE_STARTS + unset ZONE_LENGTHS + unset ZONE_WPTRS + unset ZONE_CONDS + unset ZONE_TYPES + unset REPORTED_COUNT + unset NR_CONV_ZONES +} + +# Issue reset zone command with zone count option. +# Call _get_blkzone_report() beforehand. +_reset_zones() { + local target_dev=${1} + local -i idx=${2} + local -i count=${3} + + if ! blkzone reset -o "${ZONE_STARTS[idx]}" -c "${count}" \ + "${target_dev}" >> "$FULL" 2>&1 ; then + echo "blkzone reset command failed" + return 1 + fi +} + +# Search zones and find two contiguous sequential required zones. +# Return index of the first zone of the found two zones. +# Call _get_blkzone_report() beforehand. +_find_two_contiguous_seq_zones() { + local -i type_seq=${ZONE_TYPE_SEQ_WRITE_REQUIRED} + + for ((idx = NR_CONV_ZONES; idx < REPORTED_COUNT; idx++)); do + if [[ ${ZONE_TYPES[idx]} -eq ${type_seq} && + ${ZONE_TYPES[idx+1]} -eq ${type_seq} ]]; then + echo "${idx}" + return 0 + fi + done + + echo "Contiguous sequential write required zones not found" + return 1 +} + From patchwork Thu Jan 10 09:37:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755459 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 629ED1515 for ; Thu, 10 Jan 2019 09:38:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53E54292D3 for ; Thu, 10 Jan 2019 09:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4875A29296; Thu, 10 Jan 2019 09:38:29 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 DEE47292BD for ; Thu, 10 Jan 2019 09:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727892AbfAJJi2 (ORCPT ); Thu, 10 Jan 2019 04:38:28 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16282 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbfAJJi2 (ORCPT ); Thu, 10 Jan 2019 04:38:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113108; x=1578649108; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OHNEgPsvje071JZF8Ps1r1fXJmKXODgGJh7ZfxsTKDc=; b=UroAkNbc8FLfnay6OgreF/olXedVItGx1RhPCdH6Ur75QUynJvZ2EKbk jkFNLCqz+0OMWBRWkY40mis4L66dDD80oE74AXMEsV34NGC4iZfs4ohHl U8k26So91dTeAEgp+nExyMswM7ZNFojce8VUSQspfxlddLZANs3Cts5sy PPyfna8fp94HblS+3xD3ZHIlsrL8l/OE6U/bmUMiKDF0n2zGZtSeh2toD 1M4kjWgQzUYyYt7UH0XXeeQrx9CCt088ow4LhZwpsbIAOuNn3vY0JqePU GcPWne8P2rh9wk0fRc+kos9nLBpeWZALRHKXSnikwJQKdxtFafLNqCXg1 g==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="100223368" 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; 10 Jan 2019 17:38:28 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:19:58 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:24 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 12/16] zbd/001: sysfs and ioctl consistency test Date: Thu, 10 Jan 2019 18:37:21 +0900 Message-Id: <20190110093725.32675-13-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 From: Masato Suzuki Obtain a zoned block device attributes from sysfs and using ioctl calls and confirm the consistency of the values. Signed-off-by: Shin'ichiro Kawasaki Signed-off-by: Masato Suzuki --- tests/zbd/001 | 66 +++++++++++++++++++++++++++++++++++++++++++++++ tests/zbd/001.out | 2 ++ 2 files changed, 68 insertions(+) create mode 100755 tests/zbd/001 create mode 100644 tests/zbd/001.out diff --git a/tests/zbd/001 b/tests/zbd/001 new file mode 100755 index 0000000..7f16c9a --- /dev/null +++ b/tests/zbd/001 @@ -0,0 +1,66 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Western Digital Corporation or its affiliates. +# +# Check zoned block device sysfs and ioctl parameter availability and +# confirm consistency among them. + +. tests/zbd/rc + +DESCRIPTION="sysfs and ioctl" +QUICK=1 + +requires() { + _have_src_program zbdioctl +} + +test_device() { + echo "Running ${TEST_NAME}" + + # Get and keep sysfs variables + _get_sysfs_variable "${TEST_DEV}" || return $? + local -i capacity=${SYSFS_VARS[$SV_CAPACITY]} + local -i chunk_sectors=${SYSFS_VARS[$SV_CHUNK_SECTORS]} + + # Calculate expected number of zones based on the total capacity and + # zone size, taking into account that the last zone can be smaller + # than other zones. + local -i nr_zones=$(( (capacity - 1) / chunk_sectors + 1 )) + + # Compare sysfs values and ioctl values + if [[ -e "${TEST_DEV_SYSFS}"/queue/nr_zones ]]; then + local -i sysfs_nr_zones=${SYSFS_VARS[$SV_NR_ZONES]} + local -i ioctl_nr_zones + local -i ioctl_zonesize + + ioctl_zonesize=$(src/zbdioctl -s "${TEST_DEV}") + if [[ ${chunk_sectors} -ne ${ioctl_zonesize} ]]; then + echo -n "ioctl zone size:${ioctl_zonesize} != " + echo "sysfs chunk_sectors:${chunk_sectors}" + return 1 + fi + + ioctl_nr_zones=$(src/zbdioctl -n "${TEST_DEV}") + if [[ ${nr_zones} -ne ${ioctl_nr_zones} ]]; then + echo -n "ioctl nr_zones:${ioctl_nr_zones} != " + echo "nr_zones:${nr_zones}" + return 1 + fi + + if [[ ${nr_zones} -ne ${sysfs_nr_zones} ]]; then + echo -n "sysfs nr_zones:${sysfs_nr_zones} != " + echo "nr_zones:${nr_zones}" + return 1 + fi + fi + + _put_sysfs_variable + { + echo "Capacity: ${capacity} sectors" + echo "Zone: ${chunk_sectors} sectors" + echo "Number of zones: ${nr_zones} zones" + } >> "$FULL" 2>&1 + + echo "Test complete" +} + diff --git a/tests/zbd/001.out b/tests/zbd/001.out new file mode 100644 index 0000000..7d72a8f --- /dev/null +++ b/tests/zbd/001.out @@ -0,0 +1,2 @@ +Running zbd/001 +Test complete From patchwork Thu Jan 10 09:37:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755461 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 55C091515 for ; Thu, 10 Jan 2019 09:38:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45B14286DC for ; Thu, 10 Jan 2019 09:38:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A8DE292E1; Thu, 10 Jan 2019 09:38:33 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C1D75286DC for ; Thu, 10 Jan 2019 09:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727915AbfAJJic (ORCPT ); Thu, 10 Jan 2019 04:38:32 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16282 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbfAJJic (ORCPT ); Thu, 10 Jan 2019 04:38:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113112; x=1578649112; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OBGBtYmwjJ8wWnNKjXnkEfAyt68CuDq6gtWu3cK56ow=; b=SgVFKLT1BLks3RucYZ4Ea3JPEdC5cdTNE7gfKkwsHhc3Lc3v4jdAgR0b zPaKFA69mwmfE4xk1iGvKIkaN3MtkO3n0fXFx16l609cj0VGjDpSt+5KJ GMn0iTHSuSI/SEr6x218O9G88oFCzqPlMbG1UpnUmxs+Nu44wDOZSlPyy DwXrX9zkOG1MsOF7zNFznb4g6KPeSlVebP0wSUjt50qPO6dyTO9CaI2Gz +vdBit4R8GDrOOAUvrWLwH/56F9q+iabby2DLdfmWcbwk5p04v0kWSK9N zV8XLt7xl9XekND3fUplEevUo2QhvHHFPpydSnsjTw2DMnkWGFusZXivx w==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="100223371" 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; 10 Jan 2019 17:38:32 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:20:02 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:28 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 13/16] zbd/002: report zone test Date: Thu, 10 Jan 2019 18:37:22 +0900 Message-Id: <20190110093725.32675-14-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 From: Masato Suzuki Get a report for all zones and confirm that the reported values are valid and consistent with regard to the device capacity and zone size. Signed-off-by: Masato Suzuki --- tests/zbd/002 | 99 +++++++++++++++++++++++++++++++++++++++++++++++ tests/zbd/002.out | 2 + 2 files changed, 101 insertions(+) create mode 100755 tests/zbd/002 create mode 100644 tests/zbd/002.out diff --git a/tests/zbd/002 b/tests/zbd/002 new file mode 100755 index 0000000..aec4813 --- /dev/null +++ b/tests/zbd/002 @@ -0,0 +1,99 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Western Digital Corporation or its affiliates. +# +# Issue report zone command and confirm consistency of reported values. + +. tests/zbd/rc + +DESCRIPTION="report zone" + +_check_blkzone_report() { + # Utilize local variables as much as possible to speed up loop execution + local -i max_idx=$((REPORTED_COUNT - 1)) + local -i chunk_sectors=${SYSFS_VARS[$SV_CHUNK_SECTORS]} + local -i cur_start=${ZONE_STARTS[0]} + local -i next_start=0 + local -i len=0 + local -i wptr=0 + local -i cond=0 + local -i zone_type=0 + + # Confirm number of reported zones + if [[ ${REPORTED_COUNT} -ne ${SYSFS_VARS[$SV_NR_ZONES]} ]]; then + echo "The number of zones reported differ from sysfs nr_zones" + echo -n "Reported zones count: ${REPORTED_COUNT} " + echo "sysfs nr_zones: ${SYSFS_VARS[$SV_NR_ZONES]}" + return 1 + fi + + # Check consistency between last zone size and capacity + local -i last_zone_end=$((ZONE_STARTS[max_idx] + ZONE_LENGTHS[max_idx])) + if [[ ${last_zone_end} -gt ${SYSFS_VARS[$SV_CAPACITY]} ]]; then + echo "Last zone start sector + length exceeds capacity" + echo -n "Capacity: ${SYSFS_VARS[$SV_CAPACITY]}, " + echo "last zone start sector + length: ${last_zone_end}" + return 1 + fi + + # Check each zone parameter validity and that all zones are contiguous + for ((idx = 0; idx <= max_idx; idx++)); do + + next_start=${ZONE_STARTS[$((idx+1))]} + len=${ZONE_LENGTHS[$idx]} + wptr=${ZONE_WPTRS[$idx]} + cond=${ZONE_CONDS[$idx]} + zone_type=${ZONE_TYPES[$idx]} + + # Check two zones are contiguous + if [[ $((cur_start+len)) -ne ${next_start} ]]; then + echo -n "Zones are not contiguous at zone ${idx}. " + echo "cur:${cur_start}+${len}, next:${next_start}" + return 1 + fi + + # Check zone size + if [[ ${len} -ne ${chunk_sectors} && + ${idx} -ne ${max_idx} ]]; then + echo -n "Zone size is not same as chunk_sectors " + echo -n "at zone ${idx}. " + echo "size: ${len}, chunk_sectors: ${chunk_sectors}" + return 1 + fi + + # Check write pointer + if [[ ${wptr} -lt 0 || ${wptr} -gt ${len} ]]; then + echo -n "Write pointer is invalid at zone ${idx}. " + echo "wp:${wptr}" + return 1 + fi + + # Check zone condition + if [[ ! ${ZONE_COND_ARRAY[cond]} ]]; then + echo -n "Zone condition is incorrect at zone ${idx}. " + echo "condition: ${cond}" + return 1 + fi + + # Check zone type + if [[ ! ${ZONE_TYPE_ARRAY[zone_type]} ]]; then + echo -n "Zone type is incorrect at zone ${idx}. " + echo "type: ${zone_type}" + return 1 + fi + cur_start=${next_start} + done + return 0 +} + +test_device() { + echo "Running ${TEST_NAME}" + + _get_sysfs_variable "${TEST_DEV}" || return $? + _get_blkzone_report "${TEST_DEV}" || return $? + _check_blkzone_report || return $? + _put_blkzone_report + _put_sysfs_variable + + echo "Test complete" +} diff --git a/tests/zbd/002.out b/tests/zbd/002.out new file mode 100644 index 0000000..7317541 --- /dev/null +++ b/tests/zbd/002.out @@ -0,0 +1,2 @@ +Running zbd/002 +Test complete From patchwork Thu Jan 10 09:37:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755463 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 B4ACD1399 for ; Thu, 10 Jan 2019 09:38:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2DC4286DC for ; Thu, 10 Jan 2019 09:38:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97153292BD; Thu, 10 Jan 2019 09:38:37 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 482F2286DC for ; Thu, 10 Jan 2019 09:38:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727934AbfAJJif (ORCPT ); Thu, 10 Jan 2019 04:38:35 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16282 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbfAJJif (ORCPT ); Thu, 10 Jan 2019 04:38:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113116; x=1578649116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FRStSmA3z7y5GT4HO7DZcFbbF37eLE/fboNsTo5oOSo=; b=qd8yquOEj35SufcEWkfXLYoC/8AaALr5Hmys573gu3yL2LJO0QouJ6Cc fMKeu4b+rROfIFkPb7TGmY57vli52URZxlk1hzRwOzJ0/34xTUSO6cmjH YvCeT1Y2CXBoYlXjWsiF7ZJ0WVt5MvMMlMew+6DnCQjZxte6FBxsJi+7G k55dDWZSmIZBkXISyl60nxHyyk9RTfHyw34kjyVd2R3tMMJzHjNWCuD0/ pLaTEptu7rJKpHX8UnvKS75+5XEop9P5To9J2Y16peEfiQjVSNYEmtyiB mGB9OHBIwp9oqetqjLYWILwbQZHPsmKtOgPBtJ8i4drYzEcZCjQdwlW6h A==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="100223376" 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; 10 Jan 2019 17:38:36 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:20:06 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:32 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 14/16] zbd/003: Test sequential zones reset Date: Thu, 10 Jan 2019 18:37:23 +0900 Message-Id: <20190110093725.32675-15-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 From: Masato Suzuki Test zone reset operation to make sure that the BLKRESETZONE ioctl call works as expected but also that the zone sector remapping that may be done for logical devices (partitions or dm-linear devices) is correct. Signed-off-by: Shin'ichiro Kawasaki Signed-off-by: Masato Suzuki --- tests/zbd/003 | 69 +++++++++++++++++++++++++++++++++++++++++++++++ tests/zbd/003.out | 2 ++ 2 files changed, 71 insertions(+) create mode 100755 tests/zbd/003 create mode 100644 tests/zbd/003.out diff --git a/tests/zbd/003 b/tests/zbd/003 new file mode 100755 index 0000000..a44960d --- /dev/null +++ b/tests/zbd/003 @@ -0,0 +1,69 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Western Digital Corporation or its affiliates. +# +# Confirm that reset zone command for 2 contiguous sequential write +# requried zones works as expected. + +. tests/zbd/rc + +DESCRIPTION="reset sequential required zones" +QUICK=1 + +requires() { + _have_program blkzone +} + +test_device() { + local -i zone_idx + local -a target_zones + local -i phys_blk_size + + echo "Running ${TEST_NAME}" + + # Get physical block size for dd + _get_sysfs_variable "${TEST_DEV}" || return $? + phys_blk_size=${SYSFS_VARS[$SV_PHYS_BLK_SIZE]} + _put_sysfs_variable + + # Select 2 target zones so that reset zone range also get tested + _get_blkzone_report "${TEST_DEV}" || return $? + zone_idx=$(_find_two_contiguous_seq_zones) || return $? + target_zones=( "${zone_idx}" "$((zone_idx + 1))" ) + + # Reset the 2 target zones and write 4KB in each zone to increment + # their write pointer positions + _reset_zones "${TEST_DEV}" "${zone_idx}" "2" + for i in "${target_zones[@]}"; do + _dd "${TEST_DEV}" "write" "${ZONE_STARTS[$i]}" \ + "8" "${phys_blk_size}" + done + _put_blkzone_report + + # Check that the write pointers have moved by 8x512 B sectors + _get_blkzone_report "${TEST_DEV}" || return $? + for i in "${target_zones[@]}"; do + if [[ ${ZONE_WPTRS[$i]} -ne 8 ]]; then + echo -n "Unexpected write poiter position in zone ${i} " + echo "wp: ${ZONE_WPTRS[i]}" + return 1 + fi + done + + # Reset the 2 target zones + _reset_zones "${TEST_DEV}" "${zone_idx}" "2" + _put_blkzone_report + + # Check that the write pointers have moved back to position 0 + _get_blkzone_report "${TEST_DEV}" || return $? + for i in "${target_zones[@]}"; do + if [[ ${ZONE_WPTRS[i]} -ne 0 ]]; then + echo -n "Unexpected non-zero write poiter in zone ${i} " + echo "wp: ${ZONE_WPTRS[i]}" + return 1 + fi + done + _put_blkzone_report + + echo "Test complete" +} diff --git a/tests/zbd/003.out b/tests/zbd/003.out new file mode 100644 index 0000000..7326ae4 --- /dev/null +++ b/tests/zbd/003.out @@ -0,0 +1,2 @@ +Running zbd/003 +Test complete From patchwork Thu Jan 10 09:37:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755465 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 BCA9B1399 for ; Thu, 10 Jan 2019 09:38:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE793292CD for ; Thu, 10 Jan 2019 09:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2FF8292DA; Thu, 10 Jan 2019 09:38:40 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3DD63292D4 for ; Thu, 10 Jan 2019 09:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727929AbfAJJij (ORCPT ); Thu, 10 Jan 2019 04:38:39 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16282 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbfAJJij (ORCPT ); Thu, 10 Jan 2019 04:38:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113120; x=1578649120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BZ1h5LjRdO7LTJ+9LXrgZ4Qm9QNctb7y8Q91viicv7E=; b=deUqitneCq9zaiRks2rk21o6JcJQLSeyvU0utYFkB9lz5eYLplNarHfZ BF8fC/9y2g2mzPpdZ2h5oedHRo5jEb0LIWU0zZmn1uGTXnauIRJlEDTZR KE5VPOYz915Xakq18Q9NaMr2BD6Qrg9vtb4Yd9wYJ006kOQZIUlB0rtgX EeCEpEZ2S92sxbX2o64PbN9McTzucogowFaODIlqYIgBsTFflGo2kPvLC pT6mGUsQVFNxnMf4WFdeYM3FfTbvo0kPtpz8s1MuXbIOkyNK00VESAIlF nadXMZ+Dat2gcsbuyKTT5ods3oOE5pKf6EIDEIt7gprHxa7eqpBxHE9ds g==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="100223381" 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; 10 Jan 2019 17:38:40 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:20:10 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:36 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 15/16] zbd/004: Check write split accross sequential zones Date: Thu, 10 Jan 2019 18:37:24 +0900 Message-Id: <20190110093725.32675-16-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 From: Masato Suzuki Check that write operations spanning a zone boundary are correctly processed as 2 different write operations each fully within a single zone. Signed-off-by: Masato Suzuki --- tests/zbd/004 | 81 +++++++++++++++++++++++++++++++++++++++++++++++ tests/zbd/004.out | 2 ++ 2 files changed, 83 insertions(+) create mode 100755 tests/zbd/004 create mode 100644 tests/zbd/004.out diff --git a/tests/zbd/004 b/tests/zbd/004 new file mode 100755 index 0000000..7d708f4 --- /dev/null +++ b/tests/zbd/004 @@ -0,0 +1,81 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Western Digital Corporation or its affiliates. +# +# Check kernel splits write operations across a zone border. Select two +# contiguous sequential write required zones and confirm write oprations +# across the two zones succeed. + +. tests/zbd/rc + +DESCRIPTION="write split across sequential zones" +QUICK=1 + +_check_zone_cond() { + local -i idx=${1} + local -i cond=${2} + + if [[ ${ZONE_CONDS[idx]} -ne ${cond} ]]; then + echo -n "Zone ${idx} condition is not ${ZONE_COND_ARRAY[cond]} " + echo "cond: ${ZONE_COND_ARRAY[ZONE_CONDS[idx]]}" + return 1 + fi +} + +test_device() { + local -i idx + local -i phys_blk_size + local -i phys_blk_sectors + + echo "Running ${TEST_NAME}" + + # Get physical block size and sectors for dd. + _get_sysfs_variable "${TEST_DEV}" || return $? + phys_blk_size=${SYSFS_VARS[SV_PHYS_BLK_SIZE]} + phys_blk_sectors=${SYSFS_VARS[SV_PHYS_BLK_SECTORS]} + _put_sysfs_variable + + # Find target sequential required zones and reset write pointers + _get_blkzone_report "${TEST_DEV}" || return $? + idx=$(_find_two_contiguous_seq_zones) || return $? + _reset_zones "${TEST_DEV}" "${idx}" "2" + + # Confirm the zones are initialized + _put_blkzone_report + _get_blkzone_report "${TEST_DEV}" || return $? + _check_zone_cond "${idx}" "${ZONE_COND_EMPTY}" || return $? + _check_zone_cond "$((idx+1))" "${ZONE_COND_EMPTY}" || return $? + + # Fill first target zone, remaining a physical block to write + if ! _dd "${TEST_DEV}" "write" "${ZONE_STARTS[idx]}" \ + $((ZONE_LENGTHS[idx] - phys_blk_sectors)) ${phys_blk_size} ; then + echo "Fill zone failed" + return 1 + fi + + # Write across the zone border as a single block write + local -i start_sector=$((ZONE_STARTS[idx+1] - phys_blk_sectors)) + if ! _dd "${TEST_DEV}" "write" ${start_sector} \ + $((phys_blk_sectors * 2)) $((phys_blk_size * 2)) ; then + echo "Write across zone border failed" + return 1 + fi + + # Confirm the zone conditions are as expected + _put_blkzone_report + _get_blkzone_report "${TEST_DEV}" || return $? + _check_zone_cond "${idx}" "${ZONE_COND_FULL}" || return $? + _check_zone_cond "$((idx+1))" "${ZONE_COND_IMPLICIT_OPEN}" || return $? + if [[ ${ZONE_WPTRS[idx+1]} -ne ${phys_blk_sectors} ]]; then + echo -n "Unexpected write pointer for zone $((idx+1)) " + echo "wp: ${ZONE_WPTRS[idx+1]}" + return 1 + fi + + # Clean up + _reset_zones "${TEST_DEV}" "${idx}" "2" + _put_blkzone_report + + echo "Test complete" +} + diff --git a/tests/zbd/004.out b/tests/zbd/004.out new file mode 100644 index 0000000..dd4ea94 --- /dev/null +++ b/tests/zbd/004.out @@ -0,0 +1,2 @@ +Running zbd/004 +Test complete From patchwork Thu Jan 10 09:37:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 10755467 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 1CB701515 for ; Thu, 10 Jan 2019 09:38:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E103292BD for ; Thu, 10 Jan 2019 09:38:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02A76292DD; Thu, 10 Jan 2019 09:38:44 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 93CF2292CD for ; Thu, 10 Jan 2019 09:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727848AbfAJJio (ORCPT ); Thu, 10 Jan 2019 04:38:44 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16282 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbfAJJio (ORCPT ); Thu, 10 Jan 2019 04:38:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547113124; x=1578649124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KttUW25DXSCzueklgKuVjkva9JoW+uEw7MOvlYCeB/E=; b=mzecDYNJSQ9mLdiG4obkcLfAvZP2QLxlfQCcdY4Zq1qj79OLWV0Lo9rf 8rUVIsz0zHpPUispUMDOJ2G+0zeCXemXFQFdbJPnm5jxwOSFDQQfkURem ioHA5XnGR9D+jAQEu4yXqq8PVNUoy9aN0Ez9gnmHXALEyzItoC36ERFdq DQNdFr1IthPKWpd3to8j4wmxOOJLVvxC1MFd+KQr7BGo0v7+B2Z5Yb6uk /Lpf7n7/1i8HxwP/F9w+07yNvGXkXlANKgiAi+v2E1tWe3FvPx5xf+hIu M4NikHPxl5nJ3HS/B58bAFbzt+lm0HxVumXbQhIuaZf/e5H78dLvO0REe w==; X-IronPort-AV: E=Sophos;i="5.56,460,1539619200"; d="scan'208";a="100223386" 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; 10 Jan 2019 17:38:44 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2019 01:20:14 -0800 Received: from shin_dev.dhcp.fujisawa.hgst.com (HELO shin_dev.fujisawa.hgst.com) ([10.149.52.166]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Jan 2019 01:38:40 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval , Masato Suzuki , Shinichiro Kawasaki Cc: Omar Sandoval , Jens Axboe , Matias Bjorling , Hannes Reinecke , Mike Snitzer , "Martin K . Petersen" , Chaitanya Kulkarni Subject: [PATCH blktests v2 16/16] zbd/005: Test write ordering Date: Thu, 10 Jan 2019 18:37:25 +0900 Message-Id: <20190110093725.32675-17-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110093725.32675-1-shinichiro.kawasaki@wdc.com> References: <20190110093725.32675-1-shinichiro.kawasaki@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 From: Masato Suzuki Run a high queue depth direct sequential write fio job to check that write requests are not being reordered when the deadline scheduler is used. This test allowed to catch a bug fixed with commit 80e02039721 "block: mq-deadline: Fix write completion handling". Signed-off-by: Masato Suzuki --- tests/zbd/005 | 59 +++++++++++++++++++++++++++++++++++++++++++++++ tests/zbd/005.out | 2 ++ 2 files changed, 61 insertions(+) create mode 100755 tests/zbd/005 create mode 100644 tests/zbd/005.out diff --git a/tests/zbd/005 b/tests/zbd/005 new file mode 100755 index 0000000..5286a6d --- /dev/null +++ b/tests/zbd/005 @@ -0,0 +1,59 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Western Digital Corporation or its affiliates. +# +# Run a high queue depth direct sequential write fio job to check that +# write requests are not being reordered when the deadline scheduler is +# used. This test allowed to catch a bug fixed with commit 80e02039721 +# "block: mq-deadline: Fix write completion handling". + +. tests/zbd/rc + +DESCRIPTION="write command ordering" +TIMED=1 + +requires() { + _have_fio_zbd_zonemode +} + +_find_first_sequential_zone() { + for ((idx = NR_CONV_ZONES; idx < REPORTED_COUNT; idx++)); do + if [[ ${ZONE_TYPES[idx]} -eq ${ZONE_TYPE_SEQ_WRITE_REQUIRED} ]]; + then + echo "${idx}" + return 0 + fi + done + echo "Sequential write required zone not found" + + return 1 +} + +test_device() { + local -i zone_idx + local -i offset + + echo "Running ${TEST_NAME}" + + _get_sysfs_variable "${TEST_DEV}" || return $? + _get_blkzone_report "${TEST_DEV}" || return $? + + zone_idx=$(_find_first_sequential_zone) || return $? + offset=$((ZONE_STARTS[zone_idx] * 512)) + + blkzone reset -o "${ZONE_STARTS[zone_idx]}" "${TEST_DEV}" + + set_scheduler "$(basename "$(readlink -f "${TEST_DEV}")")" \ + deadline || return $? + + : "${TIMEOUT:=30}" + FIO_PERF_FIELDS=("write io" "write iops") + _fio_perf --filename="${TEST_DEV}" --name zbdwo --rw=write --direct=1 \ + --ioengine=libaio --iodepth=128 --bs=256k \ + --offset="${offset}" + + _put_blkzone_report + _put_sysfs_variable + + echo "Test complete" +} diff --git a/tests/zbd/005.out b/tests/zbd/005.out new file mode 100644 index 0000000..3ff78c6 --- /dev/null +++ b/tests/zbd/005.out @@ -0,0 +1,2 @@ +Running zbd/005 +Test complete