From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Shin'ichiro Kawasaki Subject: [PATCH v3 3/6] t/zbd: Mandate blkzone capacity report for devices with zone capacity Date: Fri, 17 Jul 2020 18:36:34 +0900 Message-Id: <20200717093637.139565-4-shinichiro.kawasaki@wdc.com> In-Reply-To: <20200717093637.139565-1-shinichiro.kawasaki@wdc.com> References: <20200717093637.139565-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: fio@vger.kernel.org, Jens Axboe Cc: Damien Le Moal , Hans Holmberg , Aravind Ramesh , Shinichiro Kawasaki List-ID: For NVMe ZNS and null_blk zoned drives, a zone capacity can be smaller than its size. To test zone capacity handling by fio for these devices, t/zbd/test-zbd-support must be able to discover zone capacities to avoid test failures. To avoid the failures, make zone capacity report by blkzone mandatory if the test target device is a ZNS device or a null_blk device. Signed-off-by: Shin'ichiro Kawasaki --- t/zbd/functions | 45 ++++++++++++++++++++++++++++++++++++++++++ t/zbd/test-zbd-support | 3 +++ 2 files changed, 48 insertions(+) diff --git a/t/zbd/functions b/t/zbd/functions index 1bd22ec4..14366e15 100644 --- a/t/zbd/functions +++ b/t/zbd/functions @@ -19,6 +19,51 @@ if [ -n "${use_libzbc}" ] && exit 1 fi +blkzone_reports_capacity() { + local dev="${1}" + + [[ -n "${blkzone}" ]] && + "${blkzone}" report -c 1 -o 0 "${dev}" | grep -q 'cap ' +} + +# Whether or not $1 (/dev/...) is a NVME ZNS device. +is_nvme_zns() { + local s + + s=/sys/block/$(basename "${1}")/device/subsystem + + if [[ ! -h "${s}" || $(realpath "${s}") != /sys/class/nvme ]]; then + return 1 + fi + + [[ $(