Skip to content

Commit bdb0130

Browse files
Hannes Reineckeaxboe
authored andcommitted
scsi: Add host and host template flag 'host_tagset'
Add Host and host template flag 'host_tagset' so hostwide tagset can be shared on multiple reply queues after the SCSI device's reply queue is converted to blk-mq hw queue. [jpg: Update comment on .can_queue and add Scsi_Host.host_tagset] Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: John Garry <john.garry@huawei.com> Tested-by: Don Brace<don.brace@microsemi.com> #SCSI resv cmds patches used 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 f5ace5e commit bdb0130

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/scsi/hosts.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
421421
shost->cmd_per_lun = sht->cmd_per_lun;
422422
shost->unchecked_isa_dma = sht->unchecked_isa_dma;
423423
shost->no_write_same = sht->no_write_same;
424+
shost->host_tagset = sht->host_tagset;
424425

425426
if (shost_eh_deadline == -1 || !sht->eh_host_reset_handler)
426427
shost->eh_deadline = -1;

drivers/scsi/scsi_lib.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
18911891
tag_set->flags |=
18921892
BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy);
18931893
tag_set->driver_data = shost;
1894+
if (shost->host_tagset)
1895+
tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
18941896

18951897
return blk_mq_alloc_tag_set(tag_set);
18961898
}

include/scsi/scsi_host.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ struct scsi_host_template {
436436
/* True if the controller does not support WRITE SAME */
437437
unsigned no_write_same:1;
438438

439+
/* True if the host uses host-wide tagspace */
440+
unsigned host_tagset:1;
441+
439442
/*
440443
* Countdown for host blocking with no commands outstanding.
441444
*/
@@ -603,7 +606,8 @@ struct Scsi_Host {
603606
*
604607
* Note: it is assumed that each hardware queue has a queue depth of
605608
* can_queue. In other words, the total queue depth per host
606-
* is nr_hw_queues * can_queue.
609+
* is nr_hw_queues * can_queue. However, for when host_tagset is set,
610+
* the total queue depth is can_queue.
607611
*/
608612
unsigned nr_hw_queues;
609613
unsigned active_mode:2;
@@ -634,6 +638,9 @@ struct Scsi_Host {
634638
/* The controller does not support WRITE SAME */
635639
unsigned no_write_same:1;
636640

641+
/* True if the host uses host-wide tagspace */
642+
unsigned host_tagset:1;
643+
637644
/* Host responded with short (<36 bytes) INQUIRY result */
638645
unsigned short_inquiry:1;
639646

0 commit comments

Comments
 (0)