All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check
@ 2021-12-01 14:28 Niklas Cassel
  2021-12-01 14:28 ` [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Niklas Cassel @ 2021-12-01 14:28 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: damien.lemoal, Niklas Cassel, linux-scsi

From: Niklas Cassel <niklas.cassel@wdc.com>

According to the ZBC (and ZAC) specification, a zone that has Zone Type set
to Conventional, must also have its Zone Condition set to
"Not Write Pointer".

Therefore, a conventional zone will never have Zone Condition set to
"Full", which means that we can omit the non-conventional prerequisite from
the zone full condition check.

Suggested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
Changes since v2:
- New patch in series, as suggested by Damien.

 drivers/scsi/sd_zbc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index ed06798983f8..749c5e5a70c7 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -62,8 +62,7 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,
 	zone.capacity = zone.len;
 	zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));
 	zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
-	if (zone.type != ZBC_ZONE_TYPE_CONV &&
-	    zone.cond == ZBC_ZONE_COND_FULL)
+	if (zone.cond == ZBC_ZONE_COND_FULL)
 		zone.wp = zone.start + zone.len;
 
 	ret = cb(&zone, idx, data);
-- 
2.33.1

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

* [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp
  2021-12-01 14:28 [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Niklas Cassel
@ 2021-12-01 14:28 ` Niklas Cassel
  2021-12-01 23:51 ` [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Damien Le Moal
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Niklas Cassel @ 2021-12-01 14:28 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: damien.lemoal, Niklas Cassel, Johannes Thumshirn, linux-scsi

From: Niklas Cassel <niklas.cassel@wdc.com>

Make sd_zbc_parse_report() use if/else when setting the write pointer,
instead of setting it unconditionally and then conditionally updating it.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
Changes since v2:
- None, simply rebased on patch 1/2.

 drivers/scsi/sd_zbc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 749c5e5a70c7..4735cc7f682c 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -61,9 +61,10 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,
 	zone.len = logical_to_sectors(sdp, get_unaligned_be64(&buf[8]));
 	zone.capacity = zone.len;
 	zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));
-	zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
 	if (zone.cond == ZBC_ZONE_COND_FULL)
 		zone.wp = zone.start + zone.len;
+	else
+		zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
 
 	ret = cb(&zone, idx, data);
 	if (ret)
-- 
2.33.1

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

* Re: [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check
  2021-12-01 14:28 [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Niklas Cassel
  2021-12-01 14:28 ` [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
@ 2021-12-01 23:51 ` Damien Le Moal
  2021-12-02  7:22 ` Johannes Thumshirn
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-12-01 23:51 UTC (permalink / raw)
  To: Niklas Cassel, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi

On 2021/12/01 23:28, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> According to the ZBC (and ZAC) specification, a zone that has Zone Type set
> to Conventional, must also have its Zone Condition set to
> "Not Write Pointer".
> 
> Therefore, a conventional zone will never have Zone Condition set to
> "Full", which means that we can omit the non-conventional prerequisite from
> the zone full condition check.
> 
> Suggested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
> Changes since v2:
> - New patch in series, as suggested by Damien.
> 
>  drivers/scsi/sd_zbc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index ed06798983f8..749c5e5a70c7 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -62,8 +62,7 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,
>  	zone.capacity = zone.len;
>  	zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));
>  	zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
> -	if (zone.type != ZBC_ZONE_TYPE_CONV &&
> -	    zone.cond == ZBC_ZONE_COND_FULL)
> +	if (zone.cond == ZBC_ZONE_COND_FULL)
>  		zone.wp = zone.start + zone.len;
>  
>  	ret = cb(&zone, idx, data);
> 

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

-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check
  2021-12-01 14:28 [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Niklas Cassel
  2021-12-01 14:28 ` [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
  2021-12-01 23:51 ` [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Damien Le Moal
@ 2021-12-02  7:22 ` Johannes Thumshirn
  2021-12-03  2:54 ` Martin K. Petersen
  2021-12-07  3:46 ` Martin K. Petersen
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2021-12-02  7:22 UTC (permalink / raw)
  To: Niklas Cassel, James E.J. Bottomley, Martin K. Petersen
  Cc: damien.lemoal, linux-scsi

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

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

* Re: [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check
  2021-12-01 14:28 [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Niklas Cassel
                   ` (2 preceding siblings ...)
  2021-12-02  7:22 ` Johannes Thumshirn
@ 2021-12-03  2:54 ` Martin K. Petersen
  2021-12-07  3:46 ` Martin K. Petersen
  4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-12-03  2:54 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: James E.J. Bottomley, Martin K. Petersen, damien.lemoal, linux-scsi


Niklas,

> According to the ZBC (and ZAC) specification, a zone that has Zone
> Type set to Conventional, must also have its Zone Condition set to
> "Not Write Pointer".

Applied to 5.17/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check
  2021-12-01 14:28 [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Niklas Cassel
                   ` (3 preceding siblings ...)
  2021-12-03  2:54 ` Martin K. Petersen
@ 2021-12-07  3:46 ` Martin K. Petersen
  4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-12-07  3:46 UTC (permalink / raw)
  To: Niklas Cassel, James E.J. Bottomley
  Cc: Martin K . Petersen, linux-scsi, damien.lemoal

On Wed, 1 Dec 2021 14:28:30 +0000, Niklas Cassel wrote:

> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> According to the ZBC (and ZAC) specification, a zone that has Zone Type set
> to Conventional, must also have its Zone Condition set to
> "Not Write Pointer".
> 
> Therefore, a conventional zone will never have Zone Condition set to
> "Full", which means that we can omit the non-conventional prerequisite from
> the zone full condition check.
> 
> [...]

Applied to 5.17/scsi-queue, thanks!

[1/2] scsi: sd_zbc: Simplify zone full condition check
      https://git.kernel.org/mkp/scsi/c/13202ebf5f33
[2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp
      https://git.kernel.org/mkp/scsi/c/bf3f120fd61c

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-12-07  3:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 14:28 [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Niklas Cassel
2021-12-01 14:28 ` [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
2021-12-01 23:51 ` [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Damien Le Moal
2021-12-02  7:22 ` Johannes Thumshirn
2021-12-03  2:54 ` Martin K. Petersen
2021-12-07  3:46 ` Martin K. Petersen

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.