@@ -403,6 +403,35 @@ show_nr_hw_queues(struct device *dev, struct device_attribute *attr, char *buf)
}
static DEVICE_ATTR(nr_hw_queues, S_IRUGO, show_nr_hw_queues, NULL);
+static ssize_t show_fair_sharing(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 sysfs_emit(buf, "%d\n",
+ !(tag_set->flags & BLK_MQ_F_DISABLE_FAIR_TAG_SHARING));
+}
+
+static ssize_t store_fair_sharing(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct Scsi_Host *shost = class_to_shost(dev);
+ struct blk_mq_tag_set *tag_set = &shost->tag_set;
+ bool enable;
+ int res;
+
+ res = kstrtobool(buf, &enable);
+ if (res < 0)
+ return res;
+ blk_mq_update_fair_sharing(tag_set, enable);
+
+ return count;
+}
+
+static DEVICE_ATTR(fair_sharing, 0644, show_fair_sharing, store_fair_sharing);
+
static struct attribute *scsi_sysfs_shost_attrs[] = {
&dev_attr_use_blk_mq.attr,
&dev_attr_unique_id.attr,
@@ -421,6 +450,7 @@ static struct attribute *scsi_sysfs_shost_attrs[] = {
&dev_attr_host_reset.attr,
&dev_attr_eh_deadline.attr,
&dev_attr_nr_hw_queues.attr,
+ &dev_attr_fair_sharing.attr,
NULL
};
Add a sysfs attribute to SCSI hosts for configuring fair tag sharing. Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ming Lei <ming.lei@redhat.com> Cc: Keith Busch <kbusch@kernel.org> Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com> Cc: Yu Kuai <yukuai1@huaweicloud.com> Cc: Ed Tsai <ed.tsai@mediatek.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/scsi_sysfs.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)