From patchwork Thu Jul 7 01:43:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9217699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B176260752 for ; Thu, 7 Jul 2016 01:43:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A172C285F7 for ; Thu, 7 Jul 2016 01:43:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9650B285F9; Thu, 7 Jul 2016 01:43:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 366E2285F7 for ; Thu, 7 Jul 2016 01:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756056AbcGGBnn (ORCPT ); Wed, 6 Jul 2016 21:43:43 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:34379 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754511AbcGGBnm (ORCPT ); Wed, 6 Jul 2016 21:43:42 -0400 Received: by mail-pa0-f65.google.com with SMTP id us13so382603pab.1; Wed, 06 Jul 2016 18:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=2038S6nd6VBPrGIbOeMsGB5RboxWHskGEJMGfLZMxN8=; b=y+pPkArv6edJqHxpI6XWr6hBq8pP+nFY1n70MtzYmU8vV+QNbPuNR9lpu+cypqj0w7 g6MnUQPol9wunChKEBAY4s7C85NBAppD59twCVQO3rvXYJRyHXr7FIyZPZi/zjrgJTNV 8FDgl3Mok2gxnX4An0QXx6G36STUnDtEP3saVnKAwQciTWIRCllu/+cjZU1Mx+yJF6v4 /hD7Z/HvmxhKHMWGztxq4UFwBkxQ5xXjmRwj1w4n3jHm0XIGTGHG8HY8gMhi6DmhSXiH Owun7wiHA8JiX3ku9tZV95BbiJxw5KsSbT35kxv/hJtDRnOMdZxcNY1cAQKJBMB4HMaL 7yUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=2038S6nd6VBPrGIbOeMsGB5RboxWHskGEJMGfLZMxN8=; b=X9WAoc9DHqTY1pJc3X5ctjGmxrqvUiBTRW1L+avuYxObvpJoBjy0bnXE1EU/j3fjKs c5wVXoL0FyrHsRO8BskT4tWYs8HPvp59BwQlWrzPtPlzeVpD+k8y2peXWBzEJCjM9WrV AJ9nt8vgg8b666+nWyr5Ogg/Qr+ToMTRKZtk8+GVP8JMKSyNVk7yz/90w2NPkFlQmXc9 cdA+sqqJJbTHM6mV4+qryxc/2icBxmik/M6DDO7OL39owtdoC41O7oE4vS6irGu/pTTh pGSLtsZc3G71mQHsEO3HuCiBn8rDLcRrRHlxv+V0kcotbdn6Noa5Ajw7r4b8ju4OTs3N OdMw== X-Gm-Message-State: ALyK8tJJSAX6QhcUCOmIh8tTF/igpSXlFSvziWZSIJKemGTMdKf1DXpu2fzYGzdIilt4vA== X-Received: by 10.66.245.1 with SMTP id xk1mr48475547pac.58.1467855821207; Wed, 06 Jul 2016 18:43:41 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id f10sm238507pfc.79.2016.07.06.18.43.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 18:43:40 -0700 (PDT) Message-ID: <577db3cc.0a6a620a.c3774.1502@mx.google.com> X-Google-Original-Message-ID: <20160707014334.1031-1-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Tom Yan Subject: [PATCH 1/2] libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching() Date: Thu, 7 Jul 2016 09:43:33 +0800 X-Mailer: git-send-email 2.9.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan 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 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6be7770..077daf0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -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 */ diff --git a/include/linux/ata.h b/include/linux/ata.h index 99346be..2d68793 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -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,