Re: [PATCHv3 08/10] scsi: allocate reserved commands

2017-02-21 Thread Christoph Hellwig
On Tue, Feb 21, 2017 at 01:27:07PM +0100, Hannes Reinecke wrote:
> The block layer already has the notion of 'reserved' commands, so
> we should be enabling scsi hosts to allocate them.

Only if using blk-mq so far, so this patch is incomplete.  But
fortunately I don't think you actually need this patch, see my reply to
the next one for details.


[PATCHv3 08/10] scsi: allocate reserved commands

2017-02-21 Thread Hannes Reinecke
The block layer already has the notion of 'reserved' commands, so
we should be enabling scsi hosts to allocate them.

Signed-off-by: Hannes Reinecke 
---
 drivers/scsi/scsi_lib.c  | 1 +
 include/scsi/scsi_host.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c35b6de..9d6aed5 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2129,6 +2129,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
shost->tag_set.ops = &scsi_mq_ops;
shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
shost->tag_set.queue_depth = shost->can_queue;
+   shost->tag_set.reserved_tags = shost->reserved_cmds;
shost->tag_set.cmd_size = cmd_size;
shost->tag_set.numa_node = NUMA_NO_NODE;
shost->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_SG_MERGE;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 36680f1..cc83dd6 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -622,6 +622,7 @@ struct Scsi_Host {
 
int this_id;
int can_queue;
+   int reserved_cmds;
short cmd_per_lun;
short unsigned int sg_tablesize;
short unsigned int sg_prot_tablesize;
-- 
1.8.5.6