libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching()
authorTom Yan <tom.ty89@gmail.com>
Tue, 12 Jul 2016 13:37:02 +0000 (21:37 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 12 Jul 2016 14:52:49 +0000 (10:52 -0400)
Without this fix, the DRA bit of the caching mode page would not
be updated when the read look-ahead feature is toggled (e.g. with
`smartctl --set`), but will only be until, for example, the write
cache feature is touched.

Signed-off-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libata-core.c
include/linux/ata.h

index 6be7770f68e9a16a2aa8555727358c7cf1df5735..077daf0d26047730a9ffdab156039a49c7acc0cf 100644 (file)
@@ -5127,7 +5127,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
                switch (qc->tf.command) {
                case ATA_CMD_SET_FEATURES:
                        if (qc->tf.feature != SETFEATURES_WC_ON &&
-                           qc->tf.feature != SETFEATURES_WC_OFF)
+                           qc->tf.feature != SETFEATURES_WC_OFF &&
+                           qc->tf.feature != SETFEATURES_RA_ON &&
+                           qc->tf.feature != SETFEATURES_RA_OFF)
                                break;
                        /* fall through */
                case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
index 99346be5a7ca8ab6986f9fe5c76e9c2787439030..2d6879392ae3c37b696ac4968893bb1d785f3da6 100644 (file)
@@ -409,6 +409,9 @@ enum {
        SETFEATURES_WC_ON       = 0x02, /* Enable write cache */
        SETFEATURES_WC_OFF      = 0x82, /* Disable write cache */
 
+       SETFEATURES_RA_ON       = 0xaa, /* Enable read look-ahead */
+       SETFEATURES_RA_OFF      = 0x55, /* Disable read look-ahead */
+
        /* Enable/Disable Automatic Acoustic Management */
        SETFEATURES_AAM_ON      = 0x42,
        SETFEATURES_AAM_OFF     = 0xC2,