Re: [PATCH v2 5/9] libata: cleanup NCQ priority handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/6/21 9:42 AM, Damien Le Moal wrote:
> The ata device flag ATA_DFLAG_NCQ_PRIO indicates if a device supports
> the NCQ Priority feature while the ATA_DFLAG_NCQ_PRIO_ENABLE device
> flag indicates if the feature is enabled. Enabling NCQ priority use is
> controlled by the user through the device sysfs attribute
> ncq_prio_enable. As a result, the ATA_DFLAG_NCQ_PRIO flag should not be
> cleared when ATA_DFLAG_NCQ_PRIO_ENABLE is not set as the device still
> supports the feature even after the user disables it. This leads to the
> following cleanups:
> - In ata_build_rw_tf(), set a command high priority bit based on the
>   ATA_DFLAG_NCQ_PRIO_ENABLE flag, not on the ATA_DFLAG_NCQ flag. That
>   is, set a command high priority only if the user enabled NCQ priority
>   use.
> - In ata_dev_config_ncq_prio(), ATA_DFLAG_NCQ_PRIO should not be cleared
>   if ATA_DFLAG_NCQ_PRIO_ENABLE is not set. If the device does not
>   support NCQ priority, both ATA_DFLAG_NCQ_PRIO and
>   ATA_DFLAG_NCQ_PRIO_ENABLE must be cleared.
> 
> With the above ata_dev_config_ncq_prio() change, ATA_DFLAG_NCQ_PRIO flag
> is set on device scan and revalidation. There is no need to trigger a
> device revalidation in ata_ncq_prio_enable_store() when the user enables
> the use of NCQ priority. Remove the revalidation code from that funciton
> to simplify it. Also change the return value from -EIO to -EINVAL when a
> user tries to enable NCQ priority for a device that does not support
> this feature.  While at it, also simplify ata_ncq_prio_enable_show().
> 
> Overall, there is no functional change introduced by this patch.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx>
> ---
>  drivers/ata/libata-core.c | 32 ++++++++++++++------------------
>  drivers/ata/libata-sata.c | 37 ++++++++++++-------------------------
>  2 files changed, 26 insertions(+), 43 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@xxxxxxx			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux