All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	"fio@vger.kernel.org" <fio@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>
Cc: Hans Holmberg <Hans.Holmberg@wdc.com>,
	Aravind Ramesh <Aravind.Ramesh@wdc.com>
Subject: Re: [PATCH v3 3/6] t/zbd: Mandate blkzone capacity report for devices with zone capacity
Date: Tue, 21 Jul 2020 09:54:51 +0000	[thread overview]
Message-ID: <CY4PR04MB37512C3F8323B44427A0F880E7780@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200717093637.139565-4-shinichiro.kawasaki@wdc.com

On 2020/07/17 18:36, Shin'ichiro Kawasaki wrote:
> 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 <shinichiro.kawasaki@wdc.com>
> ---
>  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
> +
> +	[[ $(</sys/block/$(basename "${1}")/queue/zoned) == host-managed ]]
> +}
> +
> +# Whether or not $1 (/dev/...) is a null_blk device with zone capacity smaller
> +# than zone size.
> +is_nullb_with_zone_cap() {
> +	local f
> +
> +	f=/sys/kernel/config/nullb/$(basename "${1}")
> +	[[ -r "${f}/zone_capacity" &&
> +		   $(<"${f}/zone_capacity") -lt $(<"${f}/zone_size") ]]
> +}
> +
> +# Check if blkzone is available and suitable for the test target device. If not
> +# available, print error message and return 1. Otherwise return 0.
> +check_blkzone() {
> +	local dev="${1}"
> +
> +	# If the device supports zone capacity, mandate zone capacity report by
> +	# blkzone.
> +	if (is_nvme_zns "${dev}" || is_nullb_with_zone_cap "${dev}") &&
> +				! blkzone_reports_capacity "${dev}"; then
> +		echo "Error: blkzone does not report zone capacity"
> +		echo "Error: install latest util-linux with blkzone"
> +		return 1
> +	fi
> +}
> +
>  # Reports the starting sector and length of the first sequential zone of device
>  # $1.
>  first_sequential_zone() {
> diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support
> index 80dc3f30..f086bd10 100755
> --- a/t/zbd/test-zbd-support
> +++ b/t/zbd/test-zbd-support
> @@ -863,6 +863,9 @@ if [[ -b "$realdev" ]]; then
>  	case "$(<"/sys/class/block/$basename/queue/zoned")" in
>  	host-managed|host-aware)
>  		is_zbd=true
> +		if ! check_blkzone "${dev}"; then
> +			exit 1
> +		fi
>  		if ! result=($(first_sequential_zone "$dev")); then
>  			echo "Failed to determine first sequential zone"
>  			exit 1
> 

Looks good to me.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2020-07-21  9:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  9:36 [PATCH v3 0/6] Support zone capacity Shin'ichiro Kawasaki
2020-07-17  9:36 ` [PATCH v3 1/6] zbd: Support zone capacity smaller than zone size Shin'ichiro Kawasaki
2020-07-21  9:51   ` Damien Le Moal
2020-07-17  9:36 ` [PATCH v3 2/6] options: Add zonecapacity option for zonemode=zbd Shin'ichiro Kawasaki
2020-07-21  9:52   ` Damien Le Moal
2020-07-17  9:36 ` [PATCH v3 3/6] t/zbd: Mandate blkzone capacity report for devices with zone capacity Shin'ichiro Kawasaki
2020-07-21  9:54   ` Damien Le Moal [this message]
2020-07-17  9:36 ` [PATCH v3 4/6] t/zbd: Support testing zone capacity smaller than zone size Shin'ichiro Kawasaki
2020-07-21  9:56   ` Damien Le Moal
2020-07-17  9:36 ` [PATCH v3 5/6] t/zbd: Support testing zone capacity smaller than zone size with null_blk Shin'ichiro Kawasaki
2020-07-21  9:57   ` Damien Le Moal
2020-07-17  9:36 ` [PATCH v3 6/6] t/zbd: Add test case to check zonecapacity option Shin'ichiro Kawasaki
2020-07-21  9:59   ` Damien Le Moal
2020-07-22  5:49     ` Shinichiro Kawasaki
2020-07-22  5:52       ` Damien Le Moal
2020-07-22  6:17         ` Shinichiro Kawasaki
2020-07-21 15:17 ` [PATCH v3 0/6] Support zone capacity Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR04MB37512C3F8323B44427A0F880E7780@CY4PR04MB3751.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=Aravind.Ramesh@wdc.com \
    --cc=Hans.Holmberg@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.