diff mbox series

[03/24] scsi: add 'nr_reserved_cmds' field to the SCSI host template

Message ID 20190529132901.27645-4-hare@suse.de (mailing list archive)
State Changes Requested
Headers show
Series scsi: enable reserved commands for LLDDs | expand

Commit Message

Hannes Reinecke May 29, 2019, 1:28 p.m. UTC
From: Hannes Reinecke <hare@suse.com>

Add a new field 'nr_reserved_cmds' to the SCSI host template to
instruct the block layer to set aside a tag space for reserved
commands.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/scsi_lib.c  | 1 +
 include/scsi/scsi_host.h | 6 ++++++
 2 files changed, 7 insertions(+)

Comments

John Garry May 30, 2019, 12:51 p.m. UTC | #1
On 29/05/2019 14:28, Hannes Reinecke wrote:
> From: Hannes Reinecke <hare@suse.com>
>
> Add a new field 'nr_reserved_cmds' to the SCSI host template to
> instruct the block layer to set aside a tag space for reserved
> commands.
>

Out of curiousity, is there a reason why this would not also be added to 
scsi_host_template?

> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/scsi_lib.c  | 1 +
>  include/scsi/scsi_host.h | 6 ++++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 34eaef631064..e17153a9ce7c 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1842,6 +1842,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->nr_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;
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index a5fcdad4a03e..b094e17ef2d4 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -595,6 +595,12 @@ struct Scsi_Host {
>  	 * is nr_hw_queues * can_queue.
>  	 */
>  	unsigned nr_hw_queues;
> +
> +	/*
> +	 * Number of reserved commands, if any.
> +	 */

nit: I would write, "Number of commands to reserve, if any"

> +	unsigned nr_reserved_cmds;
> +
>  	unsigned active_mode:2;
>  	unsigned unchecked_isa_dma:1;
>
>
Hannes Reinecke May 30, 2019, 2:59 p.m. UTC | #2
On 5/30/19 2:51 PM, John Garry wrote:
> On 29/05/2019 14:28, Hannes Reinecke wrote:
>> From: Hannes Reinecke <hare@suse.com>
>>
>> Add a new field 'nr_reserved_cmds' to the SCSI host template to
>> instruct the block layer to set aside a tag space for reserved
>> commands.
>>
> 
> Out of curiousity, is there a reason why this would not also be added to 
> scsi_host_template?
> 
None, really. I just didn't do it :-)\

>> Signed-off-by: Hannes Reinecke <hare@suse.com>
>> ---
>>  drivers/scsi/scsi_lib.c  | 1 +
>>  include/scsi/scsi_host.h | 6 ++++++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
>> index 34eaef631064..e17153a9ce7c 100644
>> --- a/drivers/scsi/scsi_lib.c
>> +++ b/drivers/scsi/scsi_lib.c
>> @@ -1842,6 +1842,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->nr_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;
>> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
>> index a5fcdad4a03e..b094e17ef2d4 100644
>> --- a/include/scsi/scsi_host.h
>> +++ b/include/scsi/scsi_host.h
>> @@ -595,6 +595,12 @@ struct Scsi_Host {
>>       * is nr_hw_queues * can_queue.
>>       */
>>      unsigned nr_hw_queues;
>> +
>> +    /*
>> +     * Number of reserved commands, if any.
>> +     */
> 
> nit: I would write, "Number of commands to reserve, if any"
> 
Ok.

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 34eaef631064..e17153a9ce7c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1842,6 +1842,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->nr_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;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index a5fcdad4a03e..b094e17ef2d4 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -595,6 +595,12 @@  struct Scsi_Host {
 	 * is nr_hw_queues * can_queue.
 	 */
 	unsigned nr_hw_queues;
+
+	/*
+	 * Number of reserved commands, if any.
+	 */
+	unsigned nr_reserved_cmds;
+
 	unsigned active_mode:2;
 	unsigned unchecked_isa_dma:1;