[PATCH v1 4/6] ata: libata-scsi: improves checks for ZBC_IN and ZBC_OUT commands support

Damien Le Moal <[email protected]>
Newsgroups org.kernel.vger.linux-ide
Message-ID <[email protected]>
Improve ata_scsi_cmd_is_supported() to check the service action for the
ZBC_IN and ZBC_OUT opcodes, to correctly report supported zone management
commands for zoned disks.

Signed-off-by: Damien Le Moal <[email protected]>
---
 drivers/ata/libata-scsi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index e432e521ad31..f9e6bda6833e 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3708,8 +3708,17 @@ static bool ata_scsi_cmd_is_supported(struct ata_device *dev, u8 op, u16 sa,
 		}
 		return true;
 	case ZBC_IN:
+		return sa == ZI_REPORT_ZONES && ata_dev_is_zoned(dev);
 	case ZBC_OUT:
-		return ata_id_zoned_cap(dev->id) || dev->class == ATA_DEV_ZAC;
+		switch (sa) {
+		case ZO_CLOSE_ZONE:
+		case ZO_FINISH_ZONE:
+		case ZO_OPEN_ZONE:
+		case ZO_RESET_WRITE_POINTER:
+			return ata_dev_is_zoned(dev);
+		default:
+			return false;
+		}
 	case SERVICE_ACTION_IN_16:
 		return sa == SAI_READ_CAPACITY_16;
 	case SECURITY_PROTOCOL_IN:
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.