From patchwork Tue Aug 9 10:31:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9270821 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 12C1A60754 for ; Tue, 9 Aug 2016 10:31:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0339D27F80 for ; Tue, 9 Aug 2016 10:31:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC4A127F9C; Tue, 9 Aug 2016 10:31:57 +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 AE57927F80 for ; Tue, 9 Aug 2016 10:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932164AbcHIKbz (ORCPT ); Tue, 9 Aug 2016 06:31:55 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33947 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751591AbcHIKbx (ORCPT ); Tue, 9 Aug 2016 06:31:53 -0400 Received: by mail-pf0-f193.google.com with SMTP id g202so685447pfb.1; Tue, 09 Aug 2016 03:31:53 -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=vP8EoY1YV28t4yoaV/BRKTybeVxnfzIU0D1EUQCDlw0=; b=bBzih4/kKqwO0L/BveaoPUq9M1B0lMfcpiTM+06D9zST4uMzfRaxNHkqfgvVfycWqj uqsDL1NsFOwyAGR8q8n/jthxz/khmwjroxyx8zDLZZm4zpFdsBGIqE3Y9M6W2klLfHET JJ7EeDWVrSAcNTj+gUsgEbKqs1OaJfp6kvUpeQungCaRGV+CCpinG02YVZ7DnCV+0sgZ tMYlLxI7Em+jWMQPNXWZnbGy1PgoCHoTd74WVvJADlWaExlr54Qa0P1bcIdcXf4M2Gqc +BqRbuE1BOaJKNTJHRltXulAWgODUAE1ynl2BjPsyEDThqMU5H4BStVglCO9jDHMH5ls zQpg== 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=vP8EoY1YV28t4yoaV/BRKTybeVxnfzIU0D1EUQCDlw0=; b=N8oZmUEudkfsira032+uvlsV+fzv5PLcZxhYtfMov8jN/Ix4S7peHsuQEKybNJ0YXN +sUqBz+qf4xOw87Z9uz15NSEaVHMPgPmOx9CB6zQA0aL6Xw4JrbFWO3uEQ9ukwr6h6Zu NE6Y+nIqmked9kb3HzGl5rtSJa/VGMgpA6orVoAesa83WoPRBRPiuQNh5dS68KcGQQgp 6iypHX4DRTKHaTQrkBdUw/2OxIMJWAe/w7IaPJot5IPXvG26ZFGK0rGSQ059HjecYRqM KULCLQ2dQ57p2vfFRGK/I/eas4Gtd9hYTNyRolbwkTeao1W3Xmb4hGmd7/E6NNb18oY7 uLFQ== X-Gm-Message-State: AEkoouuHJpWgZtVYJQWu+IwueMe6VGGzrZv1UBgzT/HUN6taBxjLpPi6AUqIC2mleU3S5g== X-Received: by 10.98.92.65 with SMTP id q62mr171151588pfb.70.1470738712705; Tue, 09 Aug 2016 03:31:52 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id uc1sm54998942pac.24.2016.08.09.03.31.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 03:31:52 -0700 (PDT) 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, linux-block@vger.kernel.org, Tom Yan Subject: [PATCH 2/2] libata: do not set max_sectors for LBA48 device Date: Tue, 9 Aug 2016 18:31:42 +0800 Message-Id: X-Mailer: git-send-email 2.9.2 In-Reply-To: <1dc8fff2418744a7c4bf824f789017228ac15624.1470738284.git.tom.ty89@gmail.com> References: <1dc8fff2418744a7c4bf824f789017228ac15624.1470738284.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 Along with commit 1dc8fff24187 ("libata-scsi: do not call blk_queue_max_hw_sectors()"), devices with LBA48 support will have max_sectors set to SCSI_DEFAULT_MAX_SECTORS (currently 1024), by the scsi driver. Note that the "max_sectors" here is actually the block layer limit "max_hw_sectors", while the block layer limit "max_sectors" (which is upper-bounded by "max_hw_sectors") will be set to BLK_DEF_MAX_SECTORS (currently 2560) by the scsi disk driver, since our SATL does not report an Optimal Transfer Length. Therefore, it should make more sense to have the "max_sectors" here set to SCSI_DEFAULT_MAX_SECTORS, so that both of the block layer limits will be set to 1024, than to have "max_hw_sectors" set to 65535 and have "max_sectors" set to 2560. Not to mention that neither of them seems to be a "safe" value (see ATA_HORKAGE_MAX_SEC_1024). Besides, it is in doubt that whether having max_sectors (for a single drive, which is our case) set to a value higher than 1024 would actually improve performance anyway. diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 0749f71..2a08458 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2408,7 +2408,6 @@ int ata_dev_configure(struct ata_device *dev) /* initialize to-be-configured parameters */ dev->flags &= ~ATA_DFLAG_CFG_MASK; - dev->max_sectors = 0; dev->cdb_len = 0; dev->n_sectors = 0; dev->cylinders = 0; @@ -2610,10 +2609,8 @@ int ata_dev_configure(struct ata_device *dev) dma_dir_string); } - /* determine max_sectors */ - dev->max_sectors = ATA_MAX_SECTORS; - if (dev->flags & ATA_DFLAG_LBA48) - dev->max_sectors = ATA_MAX_SECTORS_LBA48; + if (!(dev->flags & ATA_DFLAG_LBA48)) + dev->max_sectors = ATA_MAX_SECTORS; /* Limit PATA drive on SATA cable bridge transfers to udma5, 200 sectors */