Skip to content

Commit 64f1501

Browse files
John Garryaxboe
authored andcommitted
scsi: core: Show nr_hw_queues in sysfs
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 <john.garry@huawei.com> Tested-by: Douglas Gilbert <dgilbert@interlog.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent bdb0130 commit 64f1501

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/scsi/scsi_sysfs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,16 @@ show_use_blk_mq(struct device *dev, struct device_attribute *attr, char *buf)
393393
}
394394
static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL);
395395

396+
static ssize_t
397+
show_nr_hw_queues(struct device *dev, struct device_attribute *attr, char *buf)
398+
{
399+
struct Scsi_Host *shost = class_to_shost(dev);
400+
struct blk_mq_tag_set *tag_set = &shost->tag_set;
401+
402+
return snprintf(buf, 20, "%d\n", tag_set->nr_hw_queues);
403+
}
404+
static DEVICE_ATTR(nr_hw_queues, S_IRUGO, show_nr_hw_queues, NULL);
405+
396406
static struct attribute *scsi_sysfs_shost_attrs[] = {
397407
&dev_attr_use_blk_mq.attr,
398408
&dev_attr_unique_id.attr,
@@ -411,6 +421,7 @@ static struct attribute *scsi_sysfs_shost_attrs[] = {
411421
&dev_attr_prot_guard_type.attr,
412422
&dev_attr_host_reset.attr,
413423
&dev_attr_eh_deadline.attr,
424+
&dev_attr_nr_hw_queues.attr,
414425
NULL
415426
};
416427

0 commit comments

Comments
 (0)