Re: [PATCH v2 10/11] megaraid_sas: Use Block layer API to check SCSI device in-flight IO requests

Hannes Reinecke
2020-01-16T12:30:42Z

On 1/14/20 12:21 PM, Anand Lodnoor wrote:
> Remove usage of device_busy counter from driver. Instead of
> device_busy counter now driver uses 'nr_active' counter of
> request_queue to get the number of inflight request for a
> LUN.
>
> Link : https://patchwork.kernel.org/patch/11249297/
> Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
> Signed-off-by: Anand Lodnoor <anand.lodnoor@broadcom.com>
> ---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 56 ++++++++++++++++-------------
> 1 file changed, 31 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 0bdd477..f3b36fd 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -364,6 +364,35 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
> instance->max_fw_cmds = instance->max_fw_cmds-1;
> }
> }
> +
> +static inline void
> +megasas_get_msix_index(struct megasas_instance *instance,
> + struct scsi_cmnd *scmd,
> + struct megasas_cmd_fusion *cmd,
> + u8 data_arms)
> +{
> + int sdev_busy;
> +
> + /* nr_hw_queue = 1 for MegaRAID */
> + struct blk_mq_hw_ctx *hctx =
> + scmd->device->request_queue->queue_hw_ctx[0];
> +
While this might be true it would be better to use the hctx from the
request itself:

struct blk_mq_hw_ctx *hctx = scmd->request->mq_hctx;

Cheers,

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer