Re: [PATCH v2 06/20] scsi: core: Add support for reserved tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19/11/2021 19:57, Bart Van Assche wrote:
Allow SCSI LLDs to allocate reserved tags by passing the BLK_MQ_REQ_RESERVED
flag to blk_mq_alloc_request().

Cc: Hannes Reinecke <hare@xxxxxxx>
Cc: John Garry <john.garry@xxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx > ---
  drivers/scsi/scsi_lib.c  | 4 +++-
  include/scsi/scsi_host.h | 9 ++++++++-
  2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 59c3c4fbcfc0..44489ddc646c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1925,6 +1925,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
  {
  	unsigned int cmd_size, sgl_size;
  	struct blk_mq_tag_set *tag_set = &shost->tag_set;
+	unsigned int reserved_tags = shost->hostt->reserved_tags;
sgl_size = max_t(unsigned int, sizeof(struct scatterlist),
  				scsi_mq_inline_sgl_size(shost));
@@ -1940,7 +1941,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
  		tag_set->ops = &scsi_mq_ops_no_commit;
  	tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1;
  	tag_set->nr_maps = shost->nr_maps ? : 1;
-	tag_set->queue_depth = shost->can_queue;
+	tag_set->queue_depth = shost->can_queue + reserved_tags;
+	tag_set->reserved_tags = reserved_tags;
  	tag_set->cmd_size = cmd_size;
  	tag_set->numa_node = NUMA_NO_NODE;
  	tag_set->flags = BLK_MQ_F_SHOULD_MERGE;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 72e1a347baa6..ec0f7705e06a 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -367,10 +367,17 @@ struct scsi_host_template {

why no field in struct Scsi_Host?

  	/*
  	 * This determines if we will use a non-interrupt driven
  	 * or an interrupt driven scheme.  It is set to the maximum number
-	 * of simultaneous commands a single hw queue in HBA will accept.
+	 * of simultaneous commands a single hw queue in HBA will accept. Does
+	 * not include @reserved_tags.
  	 */
  	int can_queue;
+ /*
+	 * Number of tags to reserve.


A reserved tag can be allocated by passing
+	 * the BLK_MQ_REQ_RESERVED flag to blk_get_request().

I don't see why we need this comment.

+	 */
+	unsigned reserved_tags;

I thought that unsigned int was preferred

+
  	/*
  	 * In many instances, especially where disconnect / reconnect are
  	 * supported, our host also has an ID on the SCSI bus.  If this is
.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux