On Wed, May 29, 2019 at 03:28:39PM +0200, Hannes Reinecke wrote:
> Add helper functions to retrieve SCSI commands from the reserved
> tag pool.
> 
> Signed-off-by: Hannes Reinecke <h...@suse.com>
> ---
>  include/scsi/scsi_tcq.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
> index 6053d46e794e..227f3bd4e974 100644
> --- a/include/scsi/scsi_tcq.h
> +++ b/include/scsi/scsi_tcq.h
> @@ -39,5 +39,27 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct 
> Scsi_Host *shost,
>       return blk_mq_rq_to_pdu(req);
>  }
>  
> +static inline struct scsi_cmnd *scsi_get_reserved_cmd(struct scsi_device 
> *sdev)
> +{
> +     struct request *rq;
> +     struct scsi_cmnd *scmd;
> +
> +     rq = blk_mq_alloc_request(sdev->request_queue,
> +                               REQ_OP_SCSI_OUT | REQ_NOWAIT,
> +                               BLK_MQ_REQ_RESERVED);
> +     if (IS_ERR(rq))
> +             return NULL;
> +     scmd = blk_mq_rq_to_pdu(rq);
> +     scmd->request = rq;
> +     return scmd;
> +}

Now all these internal commands won't share tags with IO requests,
however, your patch switches to reserve slots for internal
commands.

This way may have performance effect on IO workloads given the
reserved tags can't be used by IO at all.

Just wondering why not use an new tagset for internal commands?

Thanks,
Ming

Reply via email to