linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] scsi: sd_zbc: Compare against block layer enum values
@ 2021-11-26 12:55 Niklas Cassel
  2021-11-26 12:56 ` [PATCH 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Niklas Cassel @ 2021-11-26 12:55 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: damien.lemoal, Niklas Cassel, linux-scsi, linux-kernel

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

sd_zbc_parse_report() fills in a struct blk_zone, which is the block layer
representation of a zone. This struct is also what will be copied to user
for a BLKREPORTZONE ioctl.

Since sd_zbc_parse_report() compares against zone.type and zone.cond, which
are members of a struct blk_zone, the correct enum values to compare
against are the enum values defined by the block layer.

These specific enum values for ZBC and the block layer happen to have the
same enum constants, but they could theoretically have been different.

Compare against the block layer enum values, to make it more obvious that
struct blk_zone is the block layer representation of a zone, and not the
SCSI/ZBC representation of a zone.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 drivers/scsi/sd_zbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index ed06798983f8..024f1bec6e5a 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -62,8 +62,8 @@ 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.type != BLK_ZONE_TYPE_CONVENTIONAL &&
+	    zone.cond == BLK_ZONE_COND_FULL)
 		zone.wp = zone.start + zone.len;
 
 	ret = cb(&zone, idx, data);
-- 
2.33.1

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

end of thread, other threads:[~2021-11-29 13:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 12:55 [PATCH 1/2] scsi: sd_zbc: Compare against block layer enum values Niklas Cassel
2021-11-26 12:56 ` [PATCH 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
2021-11-26 14:10   ` Johannes Thumshirn
2021-11-27  1:03   ` Damien Le Moal
2021-11-26 14:09 ` [PATCH 1/2] scsi: sd_zbc: Compare against block layer enum values Johannes Thumshirn
2021-11-27  1:00 ` Damien Le Moal
2021-11-27  9:58   ` Niklas Cassel
2021-11-29  7:35     ` Damien Le Moal
2021-11-29 13:15       ` Niklas Cassel

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