From patchwork Wed Aug 19 15:20:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 247978 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp561235ils; Wed, 19 Aug 2020 08:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGm3pGF+IaGa38l//drRE1dq2com2BtFKSgxAP93sgq5toymGrkVeVRnQ1l1d6FfTo40d7 X-Received: by 2002:a50:f396:: with SMTP id g22mr25451362edm.220.1597850799432; Wed, 19 Aug 2020 08:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597850799; cv=none; d=google.com; s=arc-20160816; b=ql+CV/Ih/eRJcUNbZeCOhdL2HwqXRoxxNuLIYASRZzgCL4fCHt1H1cdj/ildl0yXF7 DFacAoKt0P5aCFThbHIcsruR0JIVcc4bdTEj96wP4vKeg9El27AhxGwNXHqz9Z/UyN+X kMUS1Z66kwai7Xf3tN3Kiiss3W/LbE7ORy4locIojRIaKxWyWfAzwjYoH+EeMJmnfV/1 QmLkfuD+Nz/5O9oh44LtyGBnS6LNKQ8B+eBjm4iP8+AR2vdVGittRJoX31qgR43+tAxY /oDnkdiW6LQiwkrFPWGd5gGVMYdL+hnMewt9CcaHAdV7V2ZL9UFyTteZ5EQBEChN2Hp4 kwSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=aKOjbA5dIaZ3TyL31F4Np1jA9HEMwwGxsIC8GRGfhVI=; b=e5b2G+DEWmRrAJdgdl6x1Wyw9bAJpBRmhxnOGymwT9l0LGoZWzFvhpdotw0Zb++8w5 m46CFx2BwKeukYiTtSh6A6Kq1W0JKeOXMgU7esI+09vO9FoFrPS6Wo0fPLDxi4NGoIWW eGC9jpEkAJsTf4d6zGtEuzG7rzSyqeW6tY+k16VH5Qc6mzxHUvMMT0boGLVHAoMn0Sqo rQYx8JjILlktFX0yyhvWWN8f4gV51z2JuYXO/gXdqnVqbUHtKvrNgzM6fFeasNA0F0JS EFamMesg4kdvvPEll9nWF0ZXnaT70U0e20XCtvre3WKdlVlWHHlSFfFYO2W4htMqpqGR YNOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si3982600ejh.356.2020.08.19.08.26.39 for ; Wed, 19 Aug 2020 08:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728729AbgHSP0a (ORCPT ); Wed, 19 Aug 2020 11:26:30 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:39602 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728692AbgHSPZV (ORCPT ); Wed, 19 Aug 2020 11:25:21 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 928F0B1CB9DFE1F7A85A; Wed, 19 Aug 2020 23:24:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 19 Aug 2020 23:24:51 +0800 From: John Garry To: , , , , , , , , , , CC: , , , , , , , , John Garry Subject: [PATCH v8 13/18] scsi: core: Show nr_hw_queues in sysfs Date: Wed, 19 Aug 2020 23:20:31 +0800 Message-ID: <1597850436-116171-14-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1597850436-116171-1-git-send-email-john.garry@huawei.com> References: <1597850436-116171-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org So that we don't use a value of 0 for when Scsi_Host.nr_hw_queues is unset, use the tag_set->nr_hw_queues (which holds 1 for this case). Signed-off-by: John Garry --- drivers/scsi/scsi_sysfs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.26.2 diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 163dbcb741c1..d6e344fa33ad 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -393,6 +393,16 @@ show_use_blk_mq(struct device *dev, struct device_attribute *attr, char *buf) } static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL); +static ssize_t +show_nr_hw_queues(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct blk_mq_tag_set *tag_set = &shost->tag_set; + + return snprintf(buf, 20, "%d\n", tag_set->nr_hw_queues); +} +static DEVICE_ATTR(nr_hw_queues, S_IRUGO, show_nr_hw_queues, NULL); + static struct attribute *scsi_sysfs_shost_attrs[] = { &dev_attr_use_blk_mq.attr, &dev_attr_unique_id.attr, @@ -411,6 +421,7 @@ static struct attribute *scsi_sysfs_shost_attrs[] = { &dev_attr_prot_guard_type.attr, &dev_attr_host_reset.attr, &dev_attr_eh_deadline.attr, + &dev_attr_nr_hw_queues.attr, NULL };