linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: linux-block@vger.kernel.org, Omar Sandoval <osandov@fb.com>,
	Masato Suzuki <masato.suzuki@wdc.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Omar Sandoval <osandov@osandov.com>, Jens Axboe <axboe@kernel.dk>,
	Matias Bjorling <matias.bjorling@wdc.com>,
	Hannes Reinecke <hare@suse.de>, Mike Snitzer <snitzer@redhat.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: [PATCH blktests 13/14] zbd/004: Check write split accross sequential zones
Date: Wed,  9 Jan 2019 10:35:41 +0900	[thread overview]
Message-ID: <20190109013542.23686-14-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20190109013542.23686-1-damien.lemoal@wdc.com>

From: Masato Suzuki <masato.suzuki@wdc.com>

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 <masato.suzuki@wdc.com>
---
 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
-- 
2.20.1


  parent reply	other threads:[~2019-01-09  1:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09  1:35 [PATCH blktests 00/14] Implement zoned block device support Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 01/14] config: Introduce ZONED variable Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 02/14] common: Introduce _test_dev_is_zoned() helper function Damien Le Moal
2019-01-09  8:46   ` Johannes Thumshirn
2019-01-09  1:35 ` [PATCH blktests 03/14] common: Move set_scheduler() function from multipath-over-rdma to rc Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 04/14] block/004: Adjust fio conditions for zoned block device Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 05/14] block/013: Skip for zoned block devices Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 06/14] block/018,024: Skip when ZONED is set Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 07/14] check: Introduce group_exit() function Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 08/14] src: Introduce zbdioctl program Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 09/14] tests: Introduce zbd test group Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 10/14] zbd/001: sysfs and ioctl consistency test Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 11/14] zbd/002: report zone test Damien Le Moal
2019-01-09  1:35 ` [PATCH blktests 12/14] zbd/003: Test sequential zones reset Damien Le Moal
2019-01-09  1:35 ` Damien Le Moal [this message]
2019-01-09  1:35 ` [PATCH blktests 14/14] zbd/005: Test write ordering Damien Le Moal

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=20190109013542.23686-14-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=masato.suzuki@wdc.com \
    --cc=matias.bjorling@wdc.com \
    --cc=osandov@fb.com \
    --cc=osandov@osandov.com \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=snitzer@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).