Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp346448rwi; Thu, 27 Oct 2022 01:58:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62elHgHMTGkUUJ8iW+NiP/XfpA8GJukLQS2JjDOzneEnvCq7Iy6IfquNLwDAskskKoUo31 X-Received: by 2002:a17:907:9495:b0:78e:1bee:5919 with SMTP id dm21-20020a170907949500b0078e1bee5919mr40723313ejc.701.1666861106775; Thu, 27 Oct 2022 01:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666861106; cv=none; d=google.com; s=arc-20160816; b=F184ciqH1m5/QLpREK2wXNpMSOLI0wnAg7USCXkfm0VPUfMd4ZNZbmAoxLfEzaqta4 ZNSCAwmFC7LacAjQeqBM+roEFEy1Bb/FrF0pwiEzonliSDGkBgkYf+6rZkjMZlze3QVG vQbpOLxd+P2FgQm06D7ooSZs6xLUuFLJ8IKmdugQZpkDQd4zwkLoj+Z9j9Du9ppxNOOf FhaGS2Zn7F7R7XZ1nbe7aXe3OyfCTjVBw3+kWt4glpXSmIqF2lx5fGLakSyBAHO5PJUD 66TL+vS6U1COSO9pOu0aXKtWdycjUOGNxTueuqquO/ZfEtMggbVWAFpEUh/NvRvjmXCf 1iYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=SSkBS40VM3RFggaz3HQ6+em4qz+wWwUsxHKg1F6d7lY=; b=DTZywHHhh+IvXhLHStKRMRqvWb57bVqzNf75tzqLupOfA/aGLnRJBQKqR733/l3tw+ VFSAnmzY1abYwt9wCzVs14aEdTfAgTXGTeKp7uva51MD6LWjL0z6B6eqJDxNTejT1pQo n93UWr51rrERD3aA8Q0bVLN3PLdW57LhtWTplTe8R6znrJMtwPSjT+6hkUIMA6EvZhyW G8tZytwBZUvm7ZhkVhrlhx6tJoKd1qSyR0VLiozKAtkl/mxF0NyoBVpgNHhJQIhOk4kd ir2NSU/bW6nnAjVNeWSgKqfR8pjKY6Elb39Epiid17gxoVvatnQ9e6goedOq31hu0Ko7 JtVg== 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 m19-20020a056402511300b00461f2b974d2si1245759edd.339.2022.10.27.01.58.01; Thu, 27 Oct 2022 01:58:26 -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 S234870AbiJ0IQq (ORCPT + 99 others); Thu, 27 Oct 2022 04:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233815AbiJ0IQm (ORCPT ); Thu, 27 Oct 2022 04:16:42 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AF87EE09; Thu, 27 Oct 2022 01:16:40 -0700 (PDT) Received: from fraeml713-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MydlM3sYhz67DWp; Thu, 27 Oct 2022 16:15:11 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml713-chm.china.huawei.com (10.206.15.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 27 Oct 2022 10:16:38 +0200 Received: from [10.195.32.169] (10.195.32.169) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 27 Oct 2022 09:16:37 +0100 Message-ID: <72234b96-b3b5-606c-cf82-95e6ee86550d@huawei.com> Date: Thu, 27 Oct 2022 09:16:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH RFC v3 03/22] scsi: core: Implement reserved command handling To: Hannes Reinecke , Damien Le Moal , , , , , , , , CC: , , , , References: <1666693096-180008-1-git-send-email-john.garry@huawei.com> <1666693096-180008-4-git-send-email-john.garry@huawei.com> <5db88114-559b-970a-0437-9acdacb47f8b@suse.de> From: John Garry In-Reply-To: <5db88114-559b-970a-0437-9acdacb47f8b@suse.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.195.32.169] X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 On 27/10/2022 08:51, Hannes Reinecke wrote: >>> >>> Signed-off-by: Hannes Reinecke >>> #jpg: Set tag_set->queue_depth = shost->can_queue, and not >>> = shost->can_queue + shost->nr_reserved_cmds; >>> Signed-off-by: John Garry >>> --- >>>   drivers/scsi/hosts.c     |  3 +++ >>>   drivers/scsi/scsi_lib.c  |  2 ++ >>>   include/scsi/scsi_host.h | 15 ++++++++++++++- >>>   3 files changed, 19 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c >>> index 12346e2297fd..db89afc37bc9 100644 >>> --- a/drivers/scsi/hosts.c >>> +++ b/drivers/scsi/hosts.c >>> @@ -489,6 +489,9 @@ struct Scsi_Host *scsi_host_alloc(struct >>> scsi_host_template *sht, int privsize) >>>       if (sht->virt_boundary_mask) >>>           shost->virt_boundary_mask = sht->virt_boundary_mask; >>> +    if (sht->nr_reserved_cmds) >>> +        shost->nr_reserved_cmds = sht->nr_reserved_cmds; >>> + >> >> Nit: the if is not really necessary I think. But it does not hurt. >> > Yes, we do. > Not all HBAs are able to figure out the number of reserved commands > upfront; some modify that based on the PCI device used etc. > So I'd keep it for now. I think logically Damien is right as in the shost alloc shost->nr_reserved_cmds is initially zero, so: if (sht->nr_reserved_cmds) shost->nr_reserved_cmds = sht->nr_reserved_cmds; is same as simply: shost->nr_reserved_cmds = sht->nr_reserved_cmds; However I am just copying the coding style. Thanks, John