All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests 0/3] Support max_active_zones
@ 2020-10-01 10:15 Shin'ichiro Kawasaki
  2020-10-01 10:15 ` [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function Shin'ichiro Kawasaki
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-10-01 10:15 UTC (permalink / raw)
  To: linux-block, Omar Sandoval
  Cc: Omar Sandoval, Damien Le Moal, Johannes Thumshirn,
	Chaitanya Kulkarni, Shinichiro Kawasaki

Linux kernel 5.9 introduced a new sysfs attribute "max_active_zones". It
is an attribute of zoned block devices which indicates the limit of zones
in open or close status. When zoned block devices has this limit, test cases
block/004 and zbd/003 fail since write operations in them open zones and the
number of open zones excceds the limit.

This patch series addresses the failures. The first patch introduces a
helper function to get the max_active_zones value. Following patches modify
the two test cases to avoid the failures.

Shin'ichiro Kawasaki (3):
  common/rc: Add _test_dev_max_active_zones() helper function
  block/004: Provide max_active_zones to fio command
  zbd/003: Reset zones when the test device has max_active_zones limit

 common/rc       | 8 ++++++++
 tests/block/004 | 9 ++++-----
 tests/zbd/003   | 5 +++++
 3 files changed, 17 insertions(+), 5 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function
  2020-10-01 10:15 [PATCH blktests 0/3] Support max_active_zones Shin'ichiro Kawasaki
@ 2020-10-01 10:15 ` Shin'ichiro Kawasaki
  2020-10-01 10:26   ` Johannes Thumshirn
  2020-10-01 10:15 ` [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command Shin'ichiro Kawasaki
  2020-10-01 10:15 ` [PATCH blktests 3/3] zbd/003: Reset zones when the test device has max_active_zones limit Shin'ichiro Kawasaki
  2 siblings, 1 reply; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-10-01 10:15 UTC (permalink / raw)
  To: linux-block, Omar Sandoval
  Cc: Omar Sandoval, Damien Le Moal, Johannes Thumshirn,
	Chaitanya Kulkarni, Shinichiro Kawasaki

Linux kernel 5.9 introduced a new sysfs attribute "max_active_zones". It
is an attribute of zoned block devices which indicates the limit of zones
in open or close status. To refer the attribute from test cases,
introduce the helper function _test_dev_max_active_zones(). If the
attribute is available, the function returns the attribute value.
Otherwise, returns 0 to indicate that the device does not have the limit.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/rc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/rc b/common/rc
index cdc0150..0589431 100644
--- a/common/rc
+++ b/common/rc
@@ -272,6 +272,14 @@ _test_dev_is_partition() {
 	[[ -n ${TEST_DEV_PART_SYSFS} ]]
 }
 
+_test_dev_max_active_zones() {
+	if [[ -r "${TEST_DEV_SYSFS}/queue/max_active_zones" ]]; then
+		_test_dev_queue_get max_active_zones
+	else
+		echo 0
+	fi
+}
+
 _require_test_dev_is_partition() {
 	if ! _test_dev_is_partition; then
 		SKIP_REASON="${TEST_DEV} is not a partition device"
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command
  2020-10-01 10:15 [PATCH blktests 0/3] Support max_active_zones Shin'ichiro Kawasaki
  2020-10-01 10:15 ` [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function Shin'ichiro Kawasaki
@ 2020-10-01 10:15 ` Shin'ichiro Kawasaki
  2020-10-01 10:25   ` Johannes Thumshirn
  2020-10-01 10:15 ` [PATCH blktests 3/3] zbd/003: Reset zones when the test device has max_active_zones limit Shin'ichiro Kawasaki
  2 siblings, 1 reply; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-10-01 10:15 UTC (permalink / raw)
  To: linux-block, Omar Sandoval
  Cc: Omar Sandoval, Damien Le Moal, Johannes Thumshirn,
	Chaitanya Kulkarni, Shinichiro Kawasaki

If the test target devices is a zoned block device with max_active_zones
limit, the fio command in block/004 opens zones beyond the limit and
fails with I/O errors.

To avoid the failure, pass the limit value to fio using --max_open_zones
option. This option, which was introduced to fio together with
zonemode=zbd, keeps the number of open zones within the specified value.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/block/004 | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/block/004 b/tests/block/004
index d181725..6eff6ce 100755
--- a/tests/block/004
+++ b/tests/block/004
@@ -21,19 +21,18 @@ device_requires() {
 test_device() {
 	echo "Running ${TEST_NAME}"
 
-	local directio=""
-	local zbdmode=""
+	local -a opts=()
 
 	if _test_dev_is_zoned; then
 		_test_dev_queue_set scheduler deadline
-		directio="--direct=1"
-		zbdmode="--zonemode=zbd"
+		opts+=("--direct=1" "--zonemode=zbd")
+		opts+=("--max_open_zones=$(_test_dev_max_active_zones)")
 	fi
 
 	FIO_PERF_FIELDS=("write iops")
 	_fio_perf --bs=4k --rw=randwrite --norandommap --fsync=1 \
 		--number_ios=256 --numjobs=64 --name=flushes \
-		${directio} ${zbdmode} --filename="$TEST_DEV"
+		"${opts[@]}" --filename="$TEST_DEV"
 
 	echo "Test complete"
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH blktests 3/3] zbd/003: Reset zones when the test device has max_active_zones limit
  2020-10-01 10:15 [PATCH blktests 0/3] Support max_active_zones Shin'ichiro Kawasaki
  2020-10-01 10:15 ` [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function Shin'ichiro Kawasaki
  2020-10-01 10:15 ` [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command Shin'ichiro Kawasaki
@ 2020-10-01 10:15 ` Shin'ichiro Kawasaki
  2 siblings, 0 replies; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-10-01 10:15 UTC (permalink / raw)
  To: linux-block, Omar Sandoval
  Cc: Omar Sandoval, Damien Le Moal, Johannes Thumshirn,
	Chaitanya Kulkarni, Shinichiro Kawasaki

When the test target device has the max_active_zones limit, write
operations by test case zbd/003 may open zones beyond the limit and
trigger write failures.

To avoid the failure, check max_active_zones limit of the test target
device. If the limit is valid, reset all zones of the device at test
start to ensure that number of open zones does not exceed the limit.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/zbd/003 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/zbd/003 b/tests/zbd/003
index 079be02..1e92e81 100755
--- a/tests/zbd/003
+++ b/tests/zbd/003
@@ -30,6 +30,11 @@ test_device() {
 
 	echo "Running ${TEST_NAME}"
 
+	# When the test device has max_active_zone limit, reset all zones. This
+	# ensures the write operations in this test case do not open zones
+	# beyond the limit.
+	(($(_test_dev_max_active_zones))) && blkzone reset "${TEST_DEV}"
+
 	# Get physical block size as dd block size to meet zoned block device
 	# requirement
 	_get_sysfs_variable "${TEST_DEV}" || return $?
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command
  2020-10-01 10:15 ` [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command Shin'ichiro Kawasaki
@ 2020-10-01 10:25   ` Johannes Thumshirn
  2020-10-01 10:41     ` Shinichiro Kawasaki
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Thumshirn @ 2020-10-01 10:25 UTC (permalink / raw)
  To: Shinichiro Kawasaki, linux-block, Omar Sandoval
  Cc: Omar Sandoval, Damien Le Moal, Chaitanya Kulkarni

On 01/10/2020 12:15, Shin'ichiro Kawasaki wrote:
> If the test target devices is a zoned block device with max_active_zones
> limit, the fio command in block/004 opens zones beyond the limit and
> fails with I/O errors.
> 
> To avoid the failure, pass the limit value to fio using --max_open_zones
> option. This option, which was introduced to fio together with
> zonemode=zbd, keeps the number of open zones within the specified value.

What happens if I use a fio version that does not have the --max_open_zones 
option defined?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function
  2020-10-01 10:15 ` [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function Shin'ichiro Kawasaki
@ 2020-10-01 10:26   ` Johannes Thumshirn
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2020-10-01 10:26 UTC (permalink / raw)
  To: Shinichiro Kawasaki, linux-block, Omar Sandoval
  Cc: Omar Sandoval, Damien Le Moal, Chaitanya Kulkarni

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command
  2020-10-01 10:25   ` Johannes Thumshirn
@ 2020-10-01 10:41     ` Shinichiro Kawasaki
  2020-10-01 10:43       ` Johannes Thumshirn
  0 siblings, 1 reply; 8+ messages in thread
From: Shinichiro Kawasaki @ 2020-10-01 10:41 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: linux-block, Omar Sandoval, Omar Sandoval, Damien Le Moal,
	Chaitanya Kulkarni

On Oct 01, 2020 / 10:25, Johannes Thumshirn wrote:
> On 01/10/2020 12:15, Shin'ichiro Kawasaki wrote:
> > If the test target devices is a zoned block device with max_active_zones
> > limit, the fio command in block/004 opens zones beyond the limit and
> > fails with I/O errors.
> > 
> > To avoid the failure, pass the limit value to fio using --max_open_zones
> > option. This option, which was introduced to fio together with
> > zonemode=zbd, keeps the number of open zones within the specified value.
> 
> What happens if I use a fio version that does not have the --max_open_zones 
> option defined?

The option --max_open_zones was introduced to fio together with zonemode=zbd,
since the beginning of fio's zoned block device support. If the test target
device is a zoned block device, the test case block/004 checks that fio
supports zonemode=zbd. I think this check is valid for --max_open_zones also.

-- 
Best Regards,
Shin'ichiro Kawasaki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command
  2020-10-01 10:41     ` Shinichiro Kawasaki
@ 2020-10-01 10:43       ` Johannes Thumshirn
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2020-10-01 10:43 UTC (permalink / raw)
  To: Shinichiro Kawasaki
  Cc: linux-block, Omar Sandoval, Omar Sandoval, Damien Le Moal,
	Chaitanya Kulkarni

On 01/10/2020 12:41, Shinichiro Kawasaki wrote:
> The option --max_open_zones was introduced to fio together with zonemode=zbd,
> since the beginning of fio's zoned block device support. If the test target
> device is a zoned block device, the test case block/004 checks that fio
> supports zonemode=zbd. I think this check is valid for --max_open_zones also.
> 

OK thanks for clarifying,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-01 10:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 10:15 [PATCH blktests 0/3] Support max_active_zones Shin'ichiro Kawasaki
2020-10-01 10:15 ` [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function Shin'ichiro Kawasaki
2020-10-01 10:26   ` Johannes Thumshirn
2020-10-01 10:15 ` [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command Shin'ichiro Kawasaki
2020-10-01 10:25   ` Johannes Thumshirn
2020-10-01 10:41     ` Shinichiro Kawasaki
2020-10-01 10:43       ` Johannes Thumshirn
2020-10-01 10:15 ` [PATCH blktests 3/3] zbd/003: Reset zones when the test device has max_active_zones limit Shin'ichiro Kawasaki

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.