linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] null_blk: Fix zone write handling
@ 2020-01-09  5:03 Damien Le Moal
  2020-01-15  7:29 ` Damien Le Moal
  2020-01-15 15:18 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Damien Le Moal @ 2020-01-09  5:03 UTC (permalink / raw)
  To: linux-block, Jens Axboe

null_zone_write() only allows writing empty and implicitly opened zones.
Writing to closed and explicitly opened zones must also be allowed and
the zone condition must be transitioned to implicit open if the zone
is not explicitly opened already.

Fixes: da644b2cc1a4 ("null_blk: add zone open, close, and finish support")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/block/null_blk_zoned.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
index 5cf49d9db95e..ed34785dd64b 100644
--- a/drivers/block/null_blk_zoned.c
+++ b/drivers/block/null_blk_zoned.c
@@ -129,11 +129,13 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
 		return BLK_STS_IOERR;
 	case BLK_ZONE_COND_EMPTY:
 	case BLK_ZONE_COND_IMP_OPEN:
+	case BLK_ZONE_COND_EXP_OPEN:
+	case BLK_ZONE_COND_CLOSED:
 		/* Writes must be at the write pointer position */
 		if (sector != zone->wp)
 			return BLK_STS_IOERR;
 
-		if (zone->cond == BLK_ZONE_COND_EMPTY)
+		if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
 			zone->cond = BLK_ZONE_COND_IMP_OPEN;
 
 		zone->wp += nr_sectors;
-- 
2.24.1


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

* Re: [PATCH] null_blk: Fix zone write handling
  2020-01-09  5:03 [PATCH] null_blk: Fix zone write handling Damien Le Moal
@ 2020-01-15  7:29 ` Damien Le Moal
  2020-01-15 15:18 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2020-01-15  7:29 UTC (permalink / raw)
  To: linux-block, Jens Axboe

Jens,

Ping ?

On 2020/01/09 14:04, Damien Le Moal wrote:
> null_zone_write() only allows writing empty and implicitly opened zones.
> Writing to closed and explicitly opened zones must also be allowed and
> the zone condition must be transitioned to implicit open if the zone
> is not explicitly opened already.
> 
> Fixes: da644b2cc1a4 ("null_blk: add zone open, close, and finish support")
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
>  drivers/block/null_blk_zoned.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
> index 5cf49d9db95e..ed34785dd64b 100644
> --- a/drivers/block/null_blk_zoned.c
> +++ b/drivers/block/null_blk_zoned.c
> @@ -129,11 +129,13 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
>  		return BLK_STS_IOERR;
>  	case BLK_ZONE_COND_EMPTY:
>  	case BLK_ZONE_COND_IMP_OPEN:
> +	case BLK_ZONE_COND_EXP_OPEN:
> +	case BLK_ZONE_COND_CLOSED:
>  		/* Writes must be at the write pointer position */
>  		if (sector != zone->wp)
>  			return BLK_STS_IOERR;
>  
> -		if (zone->cond == BLK_ZONE_COND_EMPTY)
> +		if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
>  			zone->cond = BLK_ZONE_COND_IMP_OPEN;
>  
>  		zone->wp += nr_sectors;
> 


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] null_blk: Fix zone write handling
  2020-01-09  5:03 [PATCH] null_blk: Fix zone write handling Damien Le Moal
  2020-01-15  7:29 ` Damien Le Moal
@ 2020-01-15 15:18 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2020-01-15 15:18 UTC (permalink / raw)
  To: Damien Le Moal, linux-block

On 1/8/20 10:03 PM, Damien Le Moal wrote:
> null_zone_write() only allows writing empty and implicitly opened zones.
> Writing to closed and explicitly opened zones must also be allowed and
> the zone condition must be transitioned to implicit open if the zone
> is not explicitly opened already.

Applied, thanks.

-- 
Jens Axboe


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  5:03 [PATCH] null_blk: Fix zone write handling Damien Le Moal
2020-01-15  7:29 ` Damien Le Moal
2020-01-15 15:18 ` Jens Axboe

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).