]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ata: libata: Remove ATA_DFLAG_ZAC device flag
authorDamien Le Moal <dlemoal@kernel.org>
Fri, 27 Jun 2025 00:42:33 +0000 (09:42 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Mon, 30 Jun 2025 01:25:45 +0000 (10:25 +0900)
The ATA device flag ATA_DFLAG_ZAC is used to indicate if a devie is a
host managed or host aware zoned device. However, this flag is not used
in the hot path and only used during device scanning/revalidation and
for inquiry and sense SCSI command translation.

Save one bit from struct ata_device flags field by replacing this flag
with the internal helper function ata_dev_is_zac(). This function
returns true if the device class is ATA_DEV_ZAC (host managed ZAC device
case) or if its identify data reports it supports the zoned command set
(host aware ZAC device case).

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h
include/linux/libata.h

index 79b20da0a256eeeaa73586bb85456fba504b8090..3918ea624e0bc22cbbbbceaf980c2662634ced92 100644 (file)
@@ -2421,18 +2421,7 @@ static void ata_dev_config_zac(struct ata_device *dev)
        dev->zac_zones_optimal_nonseq = U32_MAX;
        dev->zac_zones_max_open = U32_MAX;
 
-       /*
-        * Always set the 'ZAC' flag for Host-managed devices.
-        */
-       if (dev->class == ATA_DEV_ZAC)
-               dev->flags |= ATA_DFLAG_ZAC;
-       else if (ata_id_zoned_cap(dev->id) == 0x01)
-               /*
-                * Check for host-aware devices.
-                */
-               dev->flags |= ATA_DFLAG_ZAC;
-
-       if (!(dev->flags & ATA_DFLAG_ZAC))
+       if (!ata_dev_is_zac(dev))
                return;
 
        if (!ata_identify_page_supported(dev, ATA_LOG_ZONED_INFORMATION)) {
index a21c9895408dc5bb74966fbd95870b3014b750c0..ccd7651710be49ae2a8cece34f25e484e8fa5af4 100644 (file)
@@ -1923,8 +1923,7 @@ static unsigned int ata_scsiop_inq_00(struct ata_device *dev,
        };
 
        for (i = 0; i < sizeof(pages); i++) {
-               if (pages[i] == 0xb6 &&
-                   !(dev->flags & ATA_DFLAG_ZAC))
+               if (pages[i] == 0xb6 && !ata_dev_is_zac(dev))
                        continue;
                rbuf[num_pages + 4] = pages[i];
                num_pages++;
@@ -2181,7 +2180,7 @@ static unsigned int ata_scsiop_inq_b2(struct ata_device *dev,
 static unsigned int ata_scsiop_inq_b6(struct ata_device *dev,
                                      struct scsi_cmnd *cmd, u8 *rbuf)
 {
-       if (!(dev->flags & ATA_DFLAG_ZAC)) {
+       if (!ata_dev_is_zac(dev)) {
                ata_scsi_set_invalid_field(dev, cmd, 2, 0xff);
                return 0;
        }
index ce5c628fa6fdcbf02cc070e64914d4142c7bbcef..48ee7acb87af0876a621477ffa4474ec96414964 100644 (file)
@@ -44,6 +44,13 @@ static inline bool ata_sstatus_online(u32 sstatus)
        return (sstatus & 0xf) == 0x3;
 }
 
+static inline bool ata_dev_is_zac(struct ata_device *dev)
+{
+       /* Host managed device or host aware device */
+       return dev->class == ATA_DEV_ZAC ||
+               ata_id_zoned_cap(dev->id) == 0x01;
+}
+
 #ifdef CONFIG_ATA_FORCE
 extern void ata_force_cbl(struct ata_port *ap);
 #else
index 1e5aec839041de78b0b37ee4f9f7c6483911402b..721f0805b6c9586a65e0ae948fbea5cbdec18a8e 100644 (file)
@@ -144,7 +144,6 @@ enum {
        ATA_DFLAG_DEVSLP        = (1 << 27), /* device supports Device Sleep */
        ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */
        ATA_DFLAG_D_SENSE       = (1 << 29), /* Descriptor sense requested */
-       ATA_DFLAG_ZAC           = (1 << 30), /* ZAC device */
 
        ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA |   \
                                   ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \