From patchwork Tue Aug 9 14:45:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9271411 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 A37456075A for ; Tue, 9 Aug 2016 14:46:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95D8328346 for ; Tue, 9 Aug 2016 14:46:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A637283F8; 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 3C72E28346 for ; Tue, 9 Aug 2016 14:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932632AbcHIOp7 (ORCPT ); Tue, 9 Aug 2016 10:45:59 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34429 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbcHIOpy (ORCPT ); Tue, 9 Aug 2016 10:45:54 -0400 Received: by mail-pf0-f194.google.com with SMTP id g202so1007767pfb.1; Tue, 09 Aug 2016 07:45:54 -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; bh=LAybFDqAHxGJE5sLVCrfTdNhmV0vpj0k3CJhc88k1oE=; b=CIoj4a5ni8krYPcxpXOCkaz+0ooc1VDfxS89UkfHXLc/Y2xe31rRkvg/yE9GgpCVcW wPDkhyD1sG2STBa4MCORM2QPDk1iuFgkwraEWsWQpet0UmWvDS0iqOTcGzALZzOdw6MI wBw/xM5eM3pxnsJBYP0za2lBO6OLu+oU3zgjN4SlBhgdlRR6vPZSFYAmlARY70Pva/oH 9Nodf2Kk3tuxjAQoZgMbdtd/veFhy/8ROhnVCqxujSq1LFNcGVuN98t4ljpckiTt9MU1 opdJMhQhgPH66aucex/q5gam6sDCc8zSyfJhgqwtTXcCdKMWtOpUs77ba/wjDLN8uOPG 2kZg== 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; bh=LAybFDqAHxGJE5sLVCrfTdNhmV0vpj0k3CJhc88k1oE=; b=SfDpi8tjXmZuLsrgI+HAiurA99bJc4uhYiH5QzQmIiu2N+fY+/ULy637wQetTiBkRw yrnGLSoERdT6E9Ncvgx0vSRE+HdomFn3PiUhWd0wTSuFoLmRN0BTg4oLPnm34+1ewnUF QNI+HTYWfT65SS6AD0b2M5nNGubg8DHThv7+98qfM1h3q4uRB1Ua88qXWwqRLy6AqDsg L66KflqRa7B7B/Qd6DEozyR5/mM+rPKuSLlkjqvoEITLo4xobwhMgmP3iiiMJygoGTAN MTQ8mLZ/MfMqpCqwJGa3oeYZVWM94wjQabkHGVansci7ioDMZNxsl6gBo5tC3wF9aJbD KE7A== X-Gm-Message-State: AEkoouvAEt1HKpZiIBFXzCUjTc5D+Z57Az+3e6l6dF+iQpyaRpUpbpXqrrmgonQmSWDbCQ== X-Received: by 10.98.59.70 with SMTP id i67mr171731409pfa.45.1470753953950; Tue, 09 Aug 2016 07:45:53 -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.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 07:45:53 -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 1/2] libata-scsi: set max_hw_sectors again only when dev->max_sectors is set Date: Tue, 9 Aug 2016 22:45:46 +0800 Message-Id: <5eceeb9ad825beb87db03b0989f746dfbe0cf3fe.1470753817.git.tom.ty89@gmail.com> X-Mailer: git-send-email 2.9.2 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan When the request queue is initialized (see __scsi_init_queue() in scsi_lib.c), the block layer limit max_hw_sectors is set to shost->max_sectors, which will be set to the "machine infinity" SCSI_DEFAULT_MAX_SECTORS (currently 1024) if sht->max_sectors is not set (see scsi_host_alloc() in hosts.c). Therefore, if dev->max_sectors is not set (or, initialized to 0), we do not call blk_queue_max_hw_sectors() again with that. diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 2bdb5da..6fee950 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1205,7 +1205,8 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, dev->flags |= ATA_DFLAG_NO_UNLOAD; /* configure max sectors */ - blk_queue_max_hw_sectors(q, dev->max_sectors); + if (dev->max_sectors) + blk_queue_max_hw_sectors(q, dev->max_sectors); if (dev->class == ATA_DEV_ATAPI) { void *buf;