Skip to content

Commit 87aab3c

Browse files
Niklas CasselDamien Le Moal
authored andcommitted
ata: libata: move NCQ related ATA_DFLAGs
ata_dev_configure() starts off by clearing all flags in ATA_DFLAG_CFG_MASK: dev->flags &= ~ATA_DFLAG_CFG_MASK; ata_dev_configure() then calls ata_dev_config_lba() which calls ata_dev_config_ncq(). ata_dev_config_ncq() will set the correct ATA_DFLAGs depending on what is actually supported. Since these flags are set by ata_dev_configure(), they should be in ATA_DFLAG_CFG_MASK and not in ATA_DFLAG_INIT_MASK. ATA_DFLAG_NCQ_PRIO_ENABLED is set via sysfs, is should therefore not be in ATA_DFLAG_CFG_MASK. It also cannot be in ATA_DFLAG_INIT_MASK, because ata_eh_schedule_probe() calls ata_dev_init(), which will clear all flags in ATA_DFLAG_INIT_MASK. This means that ATA_DFLAG_NCQ_PRIO_ENABLED (the value the user sets via sysfs) would get silently cleared if ata_eh_schedule_probe() is called. While that should only happen in certain circumstances, it still doesn't seem right that it can get silently cleared. (ata_dev_config_ncq_prio() will still clear the ATA_DFLAG_NCQ_PRIO_ENABLED flag if ATA_DFLAG_NCQ_PRIO is suddenly no longer supported after a revalidation.) Because of this, move ATA_DFLAG_NCQ_PRIO_ENABLED to be outside of both ATA_DFLAG_CFG_MASK and ATA_DFLAG_INIT_MASK. Signed-off-by: Niklas Cassel <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 7affcde commit 87aab3c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

include/linux/libata.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,21 @@ enum {
9191
ATA_DFLAG_AN = (1 << 7), /* AN configured */
9292
ATA_DFLAG_TRUSTED = (1 << 8), /* device supports trusted send/recv */
9393
ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */
94-
ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
94+
ATA_DFLAG_NCQ_SEND_RECV = (1 << 11), /* device supports NCQ SEND and RECV */
95+
ATA_DFLAG_NCQ_PRIO = (1 << 12), /* device supports NCQ priority */
96+
ATA_DFLAG_CFG_MASK = (1 << 13) - 1,
9597

96-
ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
97-
ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
98+
ATA_DFLAG_PIO = (1 << 13), /* device limited to PIO mode */
99+
ATA_DFLAG_NCQ_OFF = (1 << 14), /* device limited to non-NCQ mode */
98100
ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
99101
ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
100102
ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
101103
ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
102-
ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */
103-
ATA_DFLAG_NCQ_PRIO = (1 << 20), /* device supports NCQ priority */
104-
ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 21), /* Priority cmds sent to dev */
105-
ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
104+
ATA_DFLAG_INIT_MASK = (1 << 19) - 1,
106105

106+
ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 19), /* Priority cmds sent to dev */
107107
ATA_DFLAG_DETACH = (1 << 24),
108108
ATA_DFLAG_DETACHED = (1 << 25),
109-
110109
ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
111110
ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
112111
ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */

0 commit comments

Comments
 (0)