All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] zbd: Fix issues found with test script
@ 2020-04-13  8:32 Shin'ichiro Kawasaki
  2020-04-13  8:32 ` [PATCH 1/3] t/zbd: Fix a bug in max_open_zones() Shin'ichiro Kawasaki
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-04-13  8:32 UTC (permalink / raw)
  To: fio, Jens Axboe; +Cc: Damien Le Moal, Shinichiro Kawasaki

This series addresses issues found with t/zbd/test-zbd-support script runs with
various conditions. The three patches fix issues about maximum open zone check,
reset all zones and random read/write on empty zones, respectively.

Please consider this series for the fio upstream.

Shin'ichiro Kawasaki (3):
  t/zbd: Fix a bug in max_open_zones()
  t/zbd: Fix a bug in reset_zone() for all zones reset
  zbd: Ensure first I/O is write for random read/write to sequential
    zones

 t/zbd/functions |  6 +++---
 zbd.c           | 10 ++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.25.1



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

* [PATCH 1/3] t/zbd: Fix a bug in max_open_zones()
  2020-04-13  8:32 [PATCH 0/3] zbd: Fix issues found with test script Shin'ichiro Kawasaki
@ 2020-04-13  8:32 ` Shin'ichiro Kawasaki
  2020-04-13  9:08   ` Damien Le Moal
  2020-04-13  8:32 ` [PATCH 2/3] t/zbd: Fix a bug in reset_zone() for all zones reset Shin'ichiro Kawasaki
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-04-13  8:32 UTC (permalink / raw)
  To: fio, Jens Axboe; +Cc: Damien Le Moal, Shinichiro Kawasaki

When sg_inq command is executed to check if it can provide maximum open
zones, the command's standard output was not discarded and caused
unexpected script behavior. Fix it discarding the standard output.

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

diff --git a/t/zbd/functions b/t/zbd/functions
index 35087b15..5bffad6e 100644
--- a/t/zbd/functions
+++ b/t/zbd/functions
@@ -43,7 +43,8 @@ max_open_zones() {
     local dev=$1
 
     if [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then
-	if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" 2> /dev/null; then
+	if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" \
+		 > /dev/null 2>&1; then
 	    # Non scsi device such as null_blk can not return max open zones.
 	    # Use default value.
 	    echo 128
-- 
2.25.1



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

* [PATCH 2/3] t/zbd: Fix a bug in reset_zone() for all zones reset
  2020-04-13  8:32 [PATCH 0/3] zbd: Fix issues found with test script Shin'ichiro Kawasaki
  2020-04-13  8:32 ` [PATCH 1/3] t/zbd: Fix a bug in max_open_zones() Shin'ichiro Kawasaki
@ 2020-04-13  8:32 ` Shin'ichiro Kawasaki
  2020-04-13  9:09   ` Damien Le Moal
  2020-04-13  8:33 ` [PATCH 3/3] zbd: Ensure first I/O is write for random read/write to sequential zones Shin'ichiro Kawasaki
  2020-04-13 14:22 ` [PATCH 0/3] zbd: Fix issues found with test script Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-04-13  8:32 UTC (permalink / raw)
  To: fio, Jens Axboe; +Cc: Damien Le Moal, Shinichiro Kawasaki

The bash function reset_zone() is expected to reset all zones when -1 is
provided as its second argument. However, it fails to reset all zones
using blkzone command because of wrong and unnecessary options provided
to blkzone. Remove the option to fix it.

This failure was found with running test-zbd-support with -r option.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 t/zbd/functions | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/t/zbd/functions b/t/zbd/functions
index 5bffad6e..1bd22ec4 100644
--- a/t/zbd/functions
+++ b/t/zbd/functions
@@ -97,8 +97,7 @@ reset_zone() {
 
     if [ -n "${blkzone}" ] && [ ! -n "${use_libzbc}" ]; then
 	if [ "$offset" -lt 0 ]; then
-	    sectors=$(<"/sys/class/block/${dev#/dev/}/size")
-	    ${blkzone} reset -o "${offset}" -l "$sectors" "$dev"
+	    ${blkzone} reset "$dev"
 	else
 	    ${blkzone} reset -o "${offset}" -c 1 "$dev"
 	fi
-- 
2.25.1



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

* [PATCH 3/3] zbd: Ensure first I/O is write for random read/write to sequential zones
  2020-04-13  8:32 [PATCH 0/3] zbd: Fix issues found with test script Shin'ichiro Kawasaki
  2020-04-13  8:32 ` [PATCH 1/3] t/zbd: Fix a bug in max_open_zones() Shin'ichiro Kawasaki
  2020-04-13  8:32 ` [PATCH 2/3] t/zbd: Fix a bug in reset_zone() for all zones reset Shin'ichiro Kawasaki
@ 2020-04-13  8:33 ` Shin'ichiro Kawasaki
  2020-04-13  9:09   ` Damien Le Moal
  2020-04-13 14:22 ` [PATCH 0/3] zbd: Fix issues found with test script Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Shin'ichiro Kawasaki @ 2020-04-13  8:33 UTC (permalink / raw)
  To: fio, Jens Axboe; +Cc: Damien Le Moal, Shinichiro Kawasaki

In case read is chosen for the first random I/O for sequential write
required zones, fio stops because no data can be read from the zones with
empty status. Enforce to write at the first I/O to make sure data to read
exists for the following read operations.

The unexpected fio stop symptom was observed with test case #30 of
t/zbd/test-zbd-support. When the test case was run repeatedly resetting
all zones with -r option, it often passes with too short run time.

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

diff --git a/zbd.c b/zbd.c
index 0b0d4f40..abfa802c 100644
--- a/zbd.c
+++ b/zbd.c
@@ -1348,6 +1348,16 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
 	if (!zbd_zone_swr(zb))
 		return io_u_accept;
 
+	/*
+	 * In case read direction is chosen for the first random I/O, fio with
+	 * zonemode=zbd stops because no data can be read from zoned block
+	 * devices with all empty zones. Overwrite the first I/O direction as
+	 * write to make sure data to read exists.
+	 */
+	if (td_rw(td) && !f->zbd_info->sectors_with_data
+	    && !td->o.read_beyond_wp)
+		io_u->ddir = DDIR_WRITE;
+
 	/*
 	 * Accept the I/O offset for reads if reading beyond the write pointer
 	 * is enabled.
-- 
2.25.1



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

* Re: [PATCH 1/3] t/zbd: Fix a bug in max_open_zones()
  2020-04-13  8:32 ` [PATCH 1/3] t/zbd: Fix a bug in max_open_zones() Shin'ichiro Kawasaki
@ 2020-04-13  9:08   ` Damien Le Moal
  0 siblings, 0 replies; 8+ messages in thread
From: Damien Le Moal @ 2020-04-13  9:08 UTC (permalink / raw)
  To: Shinichiro Kawasaki, fio, Jens Axboe

On 2020/04/13 17:33, Shin'ichiro Kawasaki wrote:
> When sg_inq command is executed to check if it can provide maximum open
> zones, the command's standard output was not discarded and caused
> unexpected script behavior. Fix it discarding the standard output.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  t/zbd/functions | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/t/zbd/functions b/t/zbd/functions
> index 35087b15..5bffad6e 100644
> --- a/t/zbd/functions
> +++ b/t/zbd/functions
> @@ -43,7 +43,8 @@ max_open_zones() {
>      local dev=$1
>  
>      if [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then
> -	if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" 2> /dev/null; then
> +	if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" \
> +		 > /dev/null 2>&1; then
>  	    # Non scsi device such as null_blk can not return max open zones.
>  	    # Use default value.
>  	    echo 128
> 

Looks good.

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

-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH 2/3] t/zbd: Fix a bug in reset_zone() for all zones reset
  2020-04-13  8:32 ` [PATCH 2/3] t/zbd: Fix a bug in reset_zone() for all zones reset Shin'ichiro Kawasaki
@ 2020-04-13  9:09   ` Damien Le Moal
  0 siblings, 0 replies; 8+ messages in thread
From: Damien Le Moal @ 2020-04-13  9:09 UTC (permalink / raw)
  To: Shinichiro Kawasaki, fio, Jens Axboe

On 2020/04/13 17:33, Shin'ichiro Kawasaki wrote:
> The bash function reset_zone() is expected to reset all zones when -1 is
> provided as its second argument. However, it fails to reset all zones
> using blkzone command because of wrong and unnecessary options provided
> to blkzone. Remove the option to fix it.
> 
> This failure was found with running test-zbd-support with -r option.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  t/zbd/functions | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/t/zbd/functions b/t/zbd/functions
> index 5bffad6e..1bd22ec4 100644
> --- a/t/zbd/functions
> +++ b/t/zbd/functions
> @@ -97,8 +97,7 @@ reset_zone() {
>  
>      if [ -n "${blkzone}" ] && [ ! -n "${use_libzbc}" ]; then
>  	if [ "$offset" -lt 0 ]; then
> -	    sectors=$(<"/sys/class/block/${dev#/dev/}/size")
> -	    ${blkzone} reset -o "${offset}" -l "$sectors" "$dev"
> +	    ${blkzone} reset "$dev"
>  	else
>  	    ${blkzone} reset -o "${offset}" -c 1 "$dev"
>  	fi
> 

Looks good.

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


-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH 3/3] zbd: Ensure first I/O is write for random read/write to sequential zones
  2020-04-13  8:33 ` [PATCH 3/3] zbd: Ensure first I/O is write for random read/write to sequential zones Shin'ichiro Kawasaki
@ 2020-04-13  9:09   ` Damien Le Moal
  0 siblings, 0 replies; 8+ messages in thread
From: Damien Le Moal @ 2020-04-13  9:09 UTC (permalink / raw)
  To: Shinichiro Kawasaki, fio, Jens Axboe

On 2020/04/13 17:33, Shin'ichiro Kawasaki wrote:
> In case read is chosen for the first random I/O for sequential write
> required zones, fio stops because no data can be read from the zones with
> empty status. Enforce to write at the first I/O to make sure data to read
> exists for the following read operations.
> 
> The unexpected fio stop symptom was observed with test case #30 of
> t/zbd/test-zbd-support. When the test case was run repeatedly resetting
> all zones with -r option, it often passes with too short run time.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  zbd.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/zbd.c b/zbd.c
> index 0b0d4f40..abfa802c 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -1348,6 +1348,16 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
>  	if (!zbd_zone_swr(zb))
>  		return io_u_accept;
>  
> +	/*
> +	 * In case read direction is chosen for the first random I/O, fio with
> +	 * zonemode=zbd stops because no data can be read from zoned block
> +	 * devices with all empty zones. Overwrite the first I/O direction as
> +	 * write to make sure data to read exists.
> +	 */
> +	if (td_rw(td) && !f->zbd_info->sectors_with_data
> +	    && !td->o.read_beyond_wp)
> +		io_u->ddir = DDIR_WRITE;
> +
>  	/*
>  	 * Accept the I/O offset for reads if reading beyond the write pointer
>  	 * is enabled.
> 

Looks OK to me.

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


-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH 0/3] zbd: Fix issues found with test script
  2020-04-13  8:32 [PATCH 0/3] zbd: Fix issues found with test script Shin'ichiro Kawasaki
                   ` (2 preceding siblings ...)
  2020-04-13  8:33 ` [PATCH 3/3] zbd: Ensure first I/O is write for random read/write to sequential zones Shin'ichiro Kawasaki
@ 2020-04-13 14:22 ` Jens Axboe
  3 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2020-04-13 14:22 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, fio; +Cc: Damien Le Moal

On 4/13/20 2:32 AM, Shin'ichiro Kawasaki wrote:
> This series addresses issues found with t/zbd/test-zbd-support script runs with
> various conditions. The three patches fix issues about maximum open zone check,
> reset all zones and random read/write on empty zones, respectively.
> 
> Please consider this series for the fio upstream.

Applied, thanks.

-- 
Jens Axboe



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

end of thread, other threads:[~2020-04-13 14:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13  8:32 [PATCH 0/3] zbd: Fix issues found with test script Shin'ichiro Kawasaki
2020-04-13  8:32 ` [PATCH 1/3] t/zbd: Fix a bug in max_open_zones() Shin'ichiro Kawasaki
2020-04-13  9:08   ` Damien Le Moal
2020-04-13  8:32 ` [PATCH 2/3] t/zbd: Fix a bug in reset_zone() for all zones reset Shin'ichiro Kawasaki
2020-04-13  9:09   ` Damien Le Moal
2020-04-13  8:33 ` [PATCH 3/3] zbd: Ensure first I/O is write for random read/write to sequential zones Shin'ichiro Kawasaki
2020-04-13  9:09   ` Damien Le Moal
2020-04-13 14:22 ` [PATCH 0/3] zbd: Fix issues found with test script Jens Axboe

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.