All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: fio@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Vincent Fu <vincentfu@gmail.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
	Dmitry Fomichev <Dmitry.Fomichev@wdc.com>,
	Niklas Cassel <niklas.cassel@wdc.com>,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH v2 07/13] t/zbd: add test case to check zones in closed condition
Date: Wed, 19 Jul 2023 19:57:50 +0900	[thread overview]
Message-ID: <20230719105756.553146-8-shinichiro.kawasaki@wdc.com> (raw)
In-Reply-To: <20230719105756.553146-1-shinichiro.kawasaki@wdc.com>

When the zoned block device has max_active_zones limit, the zones in
open or closed condition consume resource on the device. If the number
of zones in open or closed condition gets larger than the
max_active_zones limit, the device reports an error. Until the recent
fix ("zbd: write to closed zones on the devices with max_active_zones
limit"), fio handled only zones in open condition as write target then
fio was not able to avoid the error.

Add a test which confirms that the fix avoids the error by handling
zones in closed condition as write target. This test case requires the
device has max_active_zones limit. Prepare zones in closed condition as
many as the max_active_zones limit. Do random write and check no error.

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

diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support
index eed3d00d..6d44faf1 100755
--- a/t/zbd/test-zbd-support
+++ b/t/zbd/test-zbd-support
@@ -1427,6 +1427,43 @@ test65() {
 	check_written $((zone_size + capacity))
 }
 
+# Test closed zones are handled as open zones. This test case requires zoned
+# block devices which has same max_open_zones and max_active_zones.
+test66() {
+	local i off
+
+	require_zbd || return $SKIP_TESTCASE
+	require_max_active_zones 2 || return $SKIP_TESTCASE
+	require_max_open_zones "${max_active_zones}" || return $SKIP_TESTCASE
+	require_seq_zones $((max_active_zones * 16)) || return $SKIP_TESTCASE
+
+	reset_zone "$dev" -1
+
+	# Prepare max_active_zones in closed condition.
+	off=$((first_sequential_zone_sector * 512))
+	run_fio --name=w --filename="$dev" --zonemod=zbd --direct=1 \
+		--offset=$((off)) --zonesize="${zone_size}" --rw=randwrite \
+		--bs=4096 --size="$((zone_size * max_active_zones))" \
+		--io_size="${zone_size}" "$(ioengine "psync")" \
+		>> "${logfile}.${test_number}" 2>&1 || return $?
+	for ((i = 0; i < max_active_zones; i++)); do
+		close_zone "$dev" $((off / 512)) || return $?
+		off=$((off + zone_size))
+	done
+
+	# Run random write to the closed zones and empty zones. This confirms
+	# that fio handles closed zones as write target open zones. Otherwise,
+	# fio writes to the empty zones and hit the max_active_zones limit.
+	off=$((first_sequential_zone_sector * 512))
+	run_one_fio_job --zonemod=zbd --direct=1 \
+		       "$(ioengine "psync")" --rw=randwrite --bs=4096 \
+		       --max_open_zones="$max_active_zones" --offset=$((off)) \
+		       --size=$((max_active_zones * 16 * zone_size)) \
+		       --io_size=$((zone_size)) --zonesize="${zone_size}" \
+		       --time_based --runtime=5s \
+		       >> "${logfile}.${test_number}" 2>&1
+}
+
 SECONDS=0
 tests=()
 dynamic_analyzer=()
-- 
2.40.1


  parent reply	other threads:[~2023-07-19 10:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 10:57 [PATCH v2 00/13] zbd: improve max_active_zones limit handling Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 01/13] zbd: get max_active_zones limit value from zoned devices Shin'ichiro Kawasaki
2023-07-19 11:08   ` Niklas Cassel
2023-07-19 10:57 ` [PATCH v2 02/13] zbd: write to closed zones on the devices with max_active_zones limit Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 03/13] zbd: print max_active_zones limit error message Shin'ichiro Kawasaki
2023-07-19 11:09   ` Niklas Cassel
2023-07-19 10:57 ` [PATCH v2 04/13] docs: modify max_open_zones option description Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 05/13] t/zbd: add close_zone helper function Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 06/13] t/zbd: add max_active_zone variable Shin'ichiro Kawasaki
2023-07-19 10:57 ` Shin'ichiro Kawasaki [this message]
2023-07-19 10:57 ` [PATCH v2 08/13] t/zbd: add test case to check max_active_zones limit error message Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 09/13] t/zbd: get max_open_zones from sysfs Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 10/13] t/zbd: fix fio failure check and SG node failure in test case 31 Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 11/13] t/zbd: add missing prep_write for test cases with write workloads Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 12/13] t/zbd: fix null_blk configuration in run-tests-against-nullb Shin'ichiro Kawasaki
2023-07-19 10:57 ` [PATCH v2 13/13] t/zbd: add max_active configs to run-tests-against-nullb Shin'ichiro Kawasaki
2023-07-20 14:50 ` [PATCH v2 00/13] zbd: improve max_active_zones limit handling Vincent Fu

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=20230719105756.553146-8-shinichiro.kawasaki@wdc.com \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=Dmitry.Fomichev@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=fio@vger.kernel.org \
    --cc=niklas.cassel@wdc.com \
    --cc=vincentfu@gmail.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.