From patchwork Tue Jul 12 13:37:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9225333 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 020BB604DB for ; Tue, 12 Jul 2016 13:37:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E71301FF21 for ; Tue, 12 Jul 2016 13:37:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB08E27BFC; Tue, 12 Jul 2016 13:37:19 +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 8CB611FF21 for ; Tue, 12 Jul 2016 13:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371AbcGLNhS (ORCPT ); Tue, 12 Jul 2016 09:37:18 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36355 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbcGLNhR (ORCPT ); Tue, 12 Jul 2016 09:37:17 -0400 Received: by mail-pf0-f194.google.com with SMTP id i123so1094582pfg.3; Tue, 12 Jul 2016 06:37:11 -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=HkS+gIe7BKIzb9z+yw0rPwXW1zhUA9Drf7L923YQNFwv4BcdW9XuCCiw8pr9k80lF3 zAxVUB0bSXzGTntiSZG5w4uWLHfy9nFeNtohOH7PA48mCSYOzlf9yslkWm3CWze5/o2Y MP3nZarK66R1RYVfrAaCP1I7f/sd8c+0HMCVU8am9O79fdwb7BDgmZzeyHSB8vDFsEmU /rHi2PghGUgcDAAY5kZPVwdyEGKu5pl/icJ0wYfI1OuhACKyzhr1E5x06EAx73TMuaes 8XNuDBGdS9RMo73BpMqknmSokk2Refejb/DXwPwdTmee9VALQFvTsFUrI2IEEk+aWf/7 vR+g== 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=QCdNm1VXSsOCGoCgv3FwifyQmbR2V1oXYnKUT1unvMXu7nZtctcpKcGgkJa6E0R1UG JuB4bo5b1QSTmHoWqjEHPdXAeYgI3UyIoqmzJV5MjYX3p5A56s4GbQjhPOQHyvGJh5AS OD6A4TPnI+ebaef0H/I1l1WF/d4jOGbOKGTgeyYZgTQ+Ugs5FDdX+sGLAHkAWKDQR0oy IEBNw3KOiTsq+gVWNUbMq/RKsVC9D4y8P9vPM5ZOludVxybsccCw7gasGVmuGZMEw57b 9fj/4gpz5pb9heNAP/QtAypfFRQGxOcuaaPmXfx0wbeig/y+DkAAgON2a5wOscd2szCX 0xTg== X-Gm-Message-State: ALyK8tJ/C9GJoCYMD65nZHHdmeiZOkFiAKuf5tbUTs96m7dQLNXO8C11E38gB2pLOl5A2g== X-Received: by 10.98.19.214 with SMTP id 83mr32479934pft.117.1468330631162; Tue, 12 Jul 2016 06:37:11 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id p187sm2301170pfg.67.2016.07.12.06.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 06:37:10 -0700 (PDT) Message-ID: <5784f286.c4d0620a.69372.3def@mx.google.com> X-Google-Original-Message-ID: <20160712133703.2076-1-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org, sergei.shtylyov@cogentembedded.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Tom Yan Subject: [PATCH v3 1/2] libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching() Date: Tue, 12 Jul 2016 21:37:02 +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,