From patchwork Tue Aug 9 14:45:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9271415 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 0826860890 for ; Tue, 9 Aug 2016 14:46:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB5D328343 for ; Tue, 9 Aug 2016 14:46:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD71E28415; Tue, 9 Aug 2016 14:46:08 +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 7E5F0283F2 for ; Tue, 9 Aug 2016 14:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932643AbcHIOqB (ORCPT ); Tue, 9 Aug 2016 10:46:01 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34438 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752269AbcHIOp5 (ORCPT ); Tue, 9 Aug 2016 10:45:57 -0400 Received: by mail-pf0-f195.google.com with SMTP id g202so1007827pfb.1; Tue, 09 Aug 2016 07:45:57 -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=39cT0Chf8HCw7/b1D+Wj9T4MKSLfvzd6B/RcZGRBSGA=; b=TU0BWJFWztMSDFPbGJncTrQYMrTslgCjiaujS/0Q90zLalarbK3iEqwAburyw1VRJ9 NAifzUBoISClylCyl5X//K9BWVqX3dOagyfUF/etlkp5pWRMaHQdyPQyqlfFmm/b54zM 1IeBnedFzdaADtoUjVD22AWmmLOxo9kA0uDwxDjns6IwqPPfOLcKwWPeekqiBAiGXoFo NZ5OeBWzmWfU+rf2vyftvD3xyeMoESwy1PF0O6yjCQf5qRjMKW5wsyWQuirKgbG20YTY DDUxZ08TjSBjmQhxa8lmHzKS+ts9eomy/mF9hlNxziZlYtcGR99CH+CXQS2Nfaq4wDY0 +ywA== 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=39cT0Chf8HCw7/b1D+Wj9T4MKSLfvzd6B/RcZGRBSGA=; b=UvqZlz4JVB8wFDm6VRx81jVODBAkiZmcrg3LSJy6qJd50oifCd+622AM/DmiuQAP94 N64jsFF/vGZjHTagOfij+556sSyqFMh359sHTo/h/21hepoWkOrBsaCYcvCco0h6KygY 1vcaoShvuplHcj5vtIgWt4jxRMSeROJ0N+4d1VxuD0AU+mjZxiWysDMnkp4aB3ejkJxN jWPebyjejzYT7zaO+MHTAreFxd0u/qiC+8wZFBmuHkNAWCIosR8zEM3f5vqyF6lzEXzr xYatUkEdFpqcd9+DU/ECEVv+QhMclMQzPrQLmsllNu2jq9Ru48NVh88mZAY7s7wLK+ZN mwQg== X-Gm-Message-State: AEkooutRv2TqOIo6ORPep4f26duzAl+sYIBmSP13QTzIwuiSoXvPuV2sKAg+4gwXwOR1xw== X-Received: by 10.98.35.7 with SMTP id j7mr173357715pfj.39.1470753956976; Tue, 09 Aug 2016 07:45:56 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id u7sm56796840paz.45.2016.08.09.07.45.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 07:45:56 -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 v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices Date: Tue, 9 Aug 2016 22:45:47 +0800 Message-Id: <10c4d38005e24bb477b5182d4fc17879139f14d9.1470753817.git.tom.ty89@gmail.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <5eceeb9ad825beb87db03b0989f746dfbe0cf3fe.1470753817.git.tom.ty89@gmail.com> References: <5eceeb9ad825beb87db03b0989f746dfbe0cf3fe.1470753817.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 Currently block layer limit max_hw_sectors is set to ATA_MAX_SECTORS_LBA48 (65535), for devices with LBA48 support. However, block layer limit max_sectors (which is the effective one; also adjustable, upper-bounded by max_hw_sectors) is set to BLK_DEF_MAX_SECTORS (currently 2560) by the scsi disk driver, since libata's SATL does not report an Optimal Transfer Length. This does not make much sense, especially when the current BLK_DEF_MAX_SECTORS appears to be unsafe for some ATA devices (see ATA_HORKAGE_MAX_SEC_1024). Truth is, the current value appears to be arbitrary anyway. See commit d2be537c3ba3 ("block: bump BLK_DEF_MAX_SECTORS to 2560"). Therefore, avoid setting dev->max_sectors when it is strictly necessary. Leave it as 0 otherwise, so that both block layer limits will remain as SCSI_DEFAULT_MAX_SECTORS (currently 1024). diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 0749f71..07259d8 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2610,10 +2610,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 */