From patchwork Tue Jul 12 13:28:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9225313 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 370D1604DB for ; Tue, 12 Jul 2016 13:28:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27C0627BFC for ; Tue, 12 Jul 2016 13:28:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C52827F9A; Tue, 12 Jul 2016 13:28:45 +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 13D0327BFC for ; Tue, 12 Jul 2016 13:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750916AbcGLN2h (ORCPT ); Tue, 12 Jul 2016 09:28:37 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35963 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750717AbcGLN2g (ORCPT ); Tue, 12 Jul 2016 09:28:36 -0400 Received: by mail-pf0-f193.google.com with SMTP id i123so1081104pfg.3; Tue, 12 Jul 2016 06:28:36 -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=GNo0I7DYP+CI96OVuwQR/DlliX0VjrTJ/vqe/RdM3bFZVq8PBNuBYyBZCrM2Vu+l3A gRFmoDxGq3j37WfMSUR44UE0t39oBmZ81TxxZqKM1UPzJd4bEiKO1ekqtS5bGNu5ltTC p3P/gP6+UUnaN1trakdlFaaCggmm+HyM23k4AFP4N7b78g9lOahI/cCC19Xva16bSYaS mKtMwuzGJjccoxBx79XfC27QYB0qcWGMTSDHE4t/104pY/b0iLhtHsy6GOeaiZ5qBXwp HFoq/02dQny1H6HzDRJn9t6OrakypOreloj5hubA9fpXg6LnR1kARwy8nUJ2WLtFwln9 bHyQ== 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=F7moiXQ1Qd+anXrXa+WkaHRlASiT4FL5bMGDWHNfmyPOZvzmMC0z3e9O10lhkk7awv IkkyeJR5gKtnTV/OxclfK4EsPUDfr1oUU8J0QIWIQkZV2k3XsGX6t7zX8damsdA0r/1c qZBWy64Jq4foYUt07RetKPxQ1bq8mVdt0VtU+E7eALdJ2Ypj5Gv03h/WdZPeWAA8+RV1 pcrRktnlRA17Yqkr/4+cvWEbfRQqRj9xGto4InOTyCBxR3OadCGf9ZErRTtFY1P3duUN lpDRxS3OYknEhhOZSDgpEk5giorzZMhmeoHsKa1GU/KRKXtTblDk68USyqxcTd89mP9d eWcA== X-Gm-Message-State: ALyK8tJaAuqmW8yEiqgXrk0+3If7iFIvpLJOWXpZkPi5bjvUVvV8aMUbwvaV+AqoP+hFBA== X-Received: by 10.98.29.81 with SMTP id d78mr44615910pfd.142.1468330115900; Tue, 12 Jul 2016 06:28:35 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id q67sm5196410pfb.31.2016.07.12.06.28.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 06:28:35 -0700 (PDT) Message-ID: <5784f083.465c620a.e5292.ffffbf2e@mx.google.com> X-Google-Original-Message-ID: <20160712132823.1765-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 v2 1/2] libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching() Date: Tue, 12 Jul 2016 21:28:22 +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,