Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2486341iob; Fri, 20 May 2022 10:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0mTiHrc6ti67J6boQTk6HJ5JAEqVtJs/Nhn0WlE8M2XySK1+irD4lUI7nAd98PirZkvkC X-Received: by 2002:a17:906:264d:b0:6fe:a134:59ae with SMTP id i13-20020a170906264d00b006fea13459aemr6173959ejc.56.1653067337134; Fri, 20 May 2022 10:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653067337; cv=none; d=google.com; s=arc-20160816; b=MsxrDqjtZpmiAXMP0mKmZapGK2XSlt44nl62zsvK4iv0wP31MfF0uYOmpkzNMKJEms w3WGUs9nWkV6qQmL77yIY5IkluX3W6VlBqIa2hQANf/PZVnUVvOJte6WHjT9f2LtCIqF Gg1pO5w6JgWaMkyQg5T9IE6R2NnBhfiC40ew4CF7H6Y/NDuEpnzO49PK4ttAhIDLlEYH egubd09ngE6ICVmqTHtSznwCvGTJphhRa/c+CNpiNRsIYUEBKTJzypR3w8dCh3JWOxJg +0dOtpHBmnVGlMXUuoUbnsfMR46fEQ15kCb91oTJ7wyJgBXWK3opYbLDeP4JRY2nxqno yxRQ== 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=wMh1DPQRxey4Ta5VYdBMAN29ZwkXTqbS6BoO2bQCHis=; b=GobiqhGAJW5XXb++VJv1gMBGi+vvwgLJn51TgzRdrGqiba7Wb1AwwfSSTZ0uBoJt9W NgaiwPBF5xIFMcLAan0MTwBESCCvL4gS9l8TIvaLSEDIlD9qzY4OhSYozkEgeZT7UBBw 9OSXUlHpnoTV8Vyib3LyiKVzPWbUnsBczgaCQCpXdtTwB3nToqnvCxk6YR+iqkbJH4B9 eTFYZ/DZyDfjaUFM1HWRGmdLjVzf+maX3jeCKuSrBqqrPGHP1aFkaT0vtTc1xfiSH3r9 uEz9Bzhii+nSA8HkIJK22rLqjPiEYEs/IMWvAHldOaJbBIpNOy9VOj5OYFRV2nj2xIGc NaNg== 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 v1-20020a50d081000000b0042aada9454bsi8387122edd.634.2022.05.20.10.21.50; Fri, 20 May 2022 10:22:17 -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 S1347043AbiETI3u (ORCPT + 99 others); Fri, 20 May 2022 04:29:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344316AbiETI3l (ORCPT ); Fri, 20 May 2022 04:29:41 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D07D61618; Fri, 20 May 2022 01:29:40 -0700 (PDT) Received: from fraeml709-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4L4KYR55tBz687XH; Fri, 20 May 2022 16:25:47 +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; Fri, 20 May 2022 10:29: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; Fri, 20 May 2022 09:29:34 +0100 From: John Garry To: , , , , , , , CC: , , , , , , , , John Garry Subject: [PATCH 4/4] libata-scsi: Cap ata_device->max_sectors according to shost->max_sectors Date: Fri, 20 May 2022 16:23:23 +0800 Message-ID: <1653035003-70312-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1653035003-70312-1-git-send-email-john.garry@huawei.com> References: <1653035003-70312-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: dggems701-chm.china.huawei.com (10.3.19.178) 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 --- 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 06c9d90238d9..25fe89791641 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1036,6 +1036,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.26.2