Skip to content

Commit

Permalink
libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
tomty89 authored and htejun committed Jul 12, 2016
1 parent 56b8cba commit 0c12735
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 3 additions & 0 deletions include/linux/ata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0c12735

Please sign in to comment.