Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp511067iog; Thu, 30 Jun 2022 05:16:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNe/Db7xhu1q+CnoWKu86MFLI65EujhHbMnEtsStLw5pcE9sHe1jsHr8jW3zkvNZIhhUvo X-Received: by 2002:a17:902:f710:b0:167:7a06:b2ce with SMTP id h16-20020a170902f71000b001677a06b2cemr15564964plo.104.1656591385786; Thu, 30 Jun 2022 05:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656591385; cv=none; d=google.com; s=arc-20160816; b=vD20RnzfmU+CqwioiOB9kllfxnJt+yJYVls2ef75pfaDaik2TPGgbDqgcPMqUfaLlo 8WwFgEFcTGtM9XAU/mEve24nSeNCm9/2AjSRb1/1xJJQ9jAnsF/8A39itjYABoiATjS5 7orGBq3lIHmfarcb2irmzd9xzqh4ddB5G/DCBf31xyWedv+CWX37Anr3U51lNwgTkrFf zEiZJ0nHR49cAzd6pnPbDuOGGTJy+4z4Ulqr71IdolwYG4tVQwkjjuDflqSOGw4NPYEl 8CBBPxwIVth+Eze4H3oAbSYpYYpiNbeCKoBx7WST2RHlVdKtCtiY6voOEX+dHlJVYgxv WAdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ggWC3MKUbblKlJxBiuaqV+U0uRszmrLMXErPtnBYuno=; b=Z5gU+64qG0wFJ/mBhmSyuc7PbwZK3agZeSK7DrhjWpe7+lMEUy9FdmqWckjo4D/rXC VeGggfaYUI/LOcyh2W8j3T8BRKT+A7DUgbIhgVPs1pvWkLcU0UphEdiCc8I+XrmVbn3s WPOujV/bCc3lF2tEn4LwRJh7h71VFh8dxRRTBYbegDCc22EnBkqy77u3QNtUPE3hXY9g aEXiECP4s1EQ194vy3PZctxQRoeFBLlZx+WBwFuOa29wLO1fvpXUVhCYJCnWCwKyKMX9 ZsK2KXCA1zbTSjPSGWMHGVhIoq2yx0R9c0MAZYQZwAASNHfQ4qhSkl2teeSBwUZ8osOd HGyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a17090a678600b001e67f6b069csi6955783pjj.131.2022.06.30.05.16.14; Thu, 30 Jun 2022 05:16:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235033AbiF3MPA (ORCPT + 99 others); Thu, 30 Jun 2022 08:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234994AbiF3MOs (ORCPT ); Thu, 30 Jun 2022 08:14:48 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 628841D0F7; Thu, 30 Jun 2022 05:14:40 -0700 (PDT) Received: from fraeml709-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LYcdq12gKz6H7dh; Thu, 30 Jun 2022 20:12:15 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml709-chm.china.huawei.com (10.206.15.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 14:14:38 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 13:14:34 +0100 From: John Garry To: , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH v5 5/5] ata: libata-scsi: Cap ata_device->max_sectors according to shost->max_sectors Date: Thu, 30 Jun 2022 20:08:12 +0800 Message-ID: <1656590892-42307-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1656590892-42307-1-git-send-email-john.garry@huawei.com> References: <1656590892-42307-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ATA devices (struct ata_device) have a max_sectors field which is configured internally in libata. This is then used to (re)configure the associated sdev request queue max_sectors value from how it is earlier set in __scsi_init_queue(). In __scsi_init_queue() the max_sectors value is set according to shost limits, which includes host DMA mapping limits. Cap the ata_device max_sectors according to shost->max_sectors to respect this shost limit. Signed-off-by: John Garry Acked-by: Damien Le Moal --- drivers/ata/libata-scsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 86dbb1cdfabd..24a43d540d9f 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1060,6 +1060,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) dev->flags |= ATA_DFLAG_NO_UNLOAD; /* configure max sectors */ + dev->max_sectors = min(dev->max_sectors, sdev->host->max_sectors); blk_queue_max_hw_sectors(q, dev->max_sectors); if (dev->class == ATA_DEV_ATAPI) { -- 2.35.3