From patchwork Wed Jul 13 04:47:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9226763 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 B7C316088F for ; Wed, 13 Jul 2016 04:48:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A91CC27F96 for ; Wed, 13 Jul 2016 04:48:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9746027D85; Wed, 13 Jul 2016 04:48:09 +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=unavailable 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 573EB27D85 for ; Wed, 13 Jul 2016 04:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750783AbcGMErx (ORCPT ); Wed, 13 Jul 2016 00:47:53 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:34909 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbcGMErw (ORCPT ); Wed, 13 Jul 2016 00:47:52 -0400 Received: by mail-pa0-f67.google.com with SMTP id dx3so2309570pab.2; Tue, 12 Jul 2016 21:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hc99R01q/rhaY79QePZGm6DvVZ3lZdx4O/apgTs/yVc=; b=bco6+OSvAgCLH1pdriRK0wr+R5zDjP0ISk6+AO+oAIl4CWrW8Hy6PXqPGIRWLtiz0T 5gDEfNWoSMOo9WdrN7Vb3qGbFE91gf55n/HUFqgfvuX2zWU2IVkEiD8w5BbJanFVtWNS 3spGfZ2ApQkSYZXnOfdmoLM3FdRov4d2M9paxbhA0Isn6GCthT1GnOMIzQwaL3lAJ2Zd cU36w6g8HOJmR26+8Jqg7STxRli6YrQfW9kG971FJXYZi1Pi1Pr/Ho84PvieP6VeE6kP ReGwSC83f+AY4mKsq5R30zKuwDzVNCNl/q0nPVMtJJsnh+Byx6CRgYDcRNuWUygYFggj 4zjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hc99R01q/rhaY79QePZGm6DvVZ3lZdx4O/apgTs/yVc=; b=e/72KqKAZumAUxFoDmU7/nWEJvkpur/GYBt3G1GqBOqAQC7Of9YFqr+BTIZFJl/Jkh M1lqkL+SGZn2zR90tENdOyc6r/ZOuk6YFZ8GgqPxkNnSsJwbC9D8BrvIoDzUy9zmcMVb P1OtB6FgQEhPIzehKTVM+fkXKjUElE/o63vO4jm2CSspXbPjQsOTw753rlYQfG5QIgOr UO+ILsxb0Ndvd69Xsk0DkVNvJJnXIKNHn6X5pJj3Rg6Wuh37MD/x7sUBNW7WQU1Q7Bhu j/u2Fv7/SLuCIhjwerPnoPNmJGko1Bb61hkcwkUBxte5D+jKofpwfjkPgXICqWHI9CpI SA6Q== X-Gm-Message-State: ALyK8tJ80lhfs3KU+TdCcH4nbizuca3ClOfX4SYZ8qDSBh52SMOm8q7lr7izmucKRif4fQ== X-Received: by 10.66.248.3 with SMTP id yi3mr10099150pac.61.1468385247333; Tue, 12 Jul 2016 21:47:27 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id 62sm4042283pfv.26.2016.07.12.21.47.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 21:47:26 -0700 (PDT) From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org, martin.petersen@oracle.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Tom Yan Subject: [RFC 3/3] libata-scsi: add optimal transfer length to block limits VPD Date: Wed, 13 Jul 2016 12:47:08 +0800 Message-Id: <5659242e8546753768944757fc86988f1986585c.1468384890.git.tom.ty89@gmail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <1c10437e3cd9be8556e77462b40ad53be542dfba.1468384890.git.tom.ty89@gmail.com> References: <1c10437e3cd9be8556e77462b40ad53be542dfba.1468384890.git.tom.ty89@gmail.com> 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 As of commit 6b7e9cde4969 ("sd: Fix rw_max for devices that report an optimal xfer size"), the scsi disk driver (correctly) derive both of the queue limits "io_opt" and "max_sectors" from the optimal transfer length field. In case we would like the two limits to be derived from a value other than BLK_DEF_MAX_SECTORS for ATA disks in the future, this patch has made it easy. Signed-off-by: Tom Yan diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index bfec66f..ab75b5e 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2305,6 +2305,13 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) put_unaligned_be16(min_io_sectors, &rbuf[6]); /* + * Optimal transfer length. + * + * This is used to derive the queue limit "max_sector" and "io_opt". + */ + put_unaligned_be32(BLK_DEF_MAX_SECTORS, &rbuf[12]); + + /* * Optimal unmap granularity. * * The ATA spec doesn't even know about a granularity or alignment