diff mbox series

[v3,40/51] scsi_debug: Use scsi_cmd_to_rq() instead of scsi_cmnd.request

Message ID 20210524030856.2824-41-bvanassche@acm.org
State Superseded
Headers show
Series Remove the request pointer from struct scsi_cmnd | expand

Commit Message

Bart Van Assche May 24, 2021, 3:08 a.m. UTC
Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_debug.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Douglas Gilbert May 25, 2021, 4:19 p.m. UTC | #1
On 2021-05-23 11:08 p.m., Bart Van Assche wrote:
> Prepare for removal of the request pointer by using scsi_cmd_to_rq()

> instead. This patch does not change any functionality.

> 

> Signed-off-by: Bart Van Assche <bvanassche@acm.org>


Acked-by: Douglas Gilbert <dgilbert@interlog.com>


> ---

>   drivers/scsi/scsi_debug.c | 13 +++++++------

>   1 file changed, 7 insertions(+), 6 deletions(-)

> 

> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c

> index 6e2ad003c179..151b0d2f49a5 100644

> --- a/drivers/scsi/scsi_debug.c

> +++ b/drivers/scsi/scsi_debug.c

> @@ -4705,7 +4705,7 @@ static int resp_rwp_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)

>   static struct sdebug_queue *get_queue(struct scsi_cmnd *cmnd)

>   {

>   	u16 hwq;

> -	u32 tag = blk_mq_unique_tag(cmnd->request);

> +	u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(cmnd));

>   

>   	hwq = blk_mq_unique_tag_to_hwq(tag);

>   

> @@ -4718,7 +4718,7 @@ static struct sdebug_queue *get_queue(struct scsi_cmnd *cmnd)

>   

>   static u32 get_tag(struct scsi_cmnd *cmnd)

>   {

> -	return blk_mq_unique_tag(cmnd->request);

> +	return blk_mq_unique_tag(scsi_cmd_to_rq(cmnd));

>   }

>   

>   /* Queued (deferred) command completions converge here. */

> @@ -5367,7 +5367,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,

>   {

>   	bool new_sd_dp;

>   	bool inject = false;

> -	bool hipri = (cmnd->request->cmd_flags & REQ_HIPRI);

> +	bool hipri = scsi_cmd_to_rq(cmnd)->cmd_flags & REQ_HIPRI;

>   	int k, num_in_q, qdepth;

>   	unsigned long iflags;

>   	u64 ns_from_boot = 0;

> @@ -5570,8 +5570,9 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,

>   		if (sdebug_statistics)

>   			sd_dp->issuing_cpu = raw_smp_processor_id();

>   		if (unlikely(sd_dp->aborted)) {

> -			sdev_printk(KERN_INFO, sdp, "abort request tag %d\n", cmnd->request->tag);

> -			blk_abort_request(cmnd->request);

> +			sdev_printk(KERN_INFO, sdp, "abort request tag %d\n",

> +				    scsi_cmd_to_rq(cmnd)->tag);

> +			blk_abort_request(scsi_cmd_to_rq(cmnd));

>   			atomic_set(&sdeb_inject_pending, 0);

>   			sd_dp->aborted = false;

>   		}

> @@ -7397,7 +7398,7 @@ static int scsi_debug_queuecommand(struct Scsi_Host *shost,

>   					       (u32)cmd[k]);

>   		}

>   		sdev_printk(KERN_INFO, sdp, "%s: tag=%#x, cmd %s\n", my_name,

> -			    blk_mq_unique_tag(scp->request), b);

> +			    blk_mq_unique_tag(scsi_cmd_to_rq(scp)), b);

>   	}

>   	if (unlikely(inject_now && (sdebug_opts & SDEBUG_OPT_HOST_BUSY)))

>   		return SCSI_MLQUEUE_HOST_BUSY;

>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 6e2ad003c179..151b0d2f49a5 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4705,7 +4705,7 @@  static int resp_rwp_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
 static struct sdebug_queue *get_queue(struct scsi_cmnd *cmnd)
 {
 	u16 hwq;
-	u32 tag = blk_mq_unique_tag(cmnd->request);
+	u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(cmnd));
 
 	hwq = blk_mq_unique_tag_to_hwq(tag);
 
@@ -4718,7 +4718,7 @@  static struct sdebug_queue *get_queue(struct scsi_cmnd *cmnd)
 
 static u32 get_tag(struct scsi_cmnd *cmnd)
 {
-	return blk_mq_unique_tag(cmnd->request);
+	return blk_mq_unique_tag(scsi_cmd_to_rq(cmnd));
 }
 
 /* Queued (deferred) command completions converge here. */
@@ -5367,7 +5367,7 @@  static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 {
 	bool new_sd_dp;
 	bool inject = false;
-	bool hipri = (cmnd->request->cmd_flags & REQ_HIPRI);
+	bool hipri = scsi_cmd_to_rq(cmnd)->cmd_flags & REQ_HIPRI;
 	int k, num_in_q, qdepth;
 	unsigned long iflags;
 	u64 ns_from_boot = 0;
@@ -5570,8 +5570,9 @@  static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 		if (sdebug_statistics)
 			sd_dp->issuing_cpu = raw_smp_processor_id();
 		if (unlikely(sd_dp->aborted)) {
-			sdev_printk(KERN_INFO, sdp, "abort request tag %d\n", cmnd->request->tag);
-			blk_abort_request(cmnd->request);
+			sdev_printk(KERN_INFO, sdp, "abort request tag %d\n",
+				    scsi_cmd_to_rq(cmnd)->tag);
+			blk_abort_request(scsi_cmd_to_rq(cmnd));
 			atomic_set(&sdeb_inject_pending, 0);
 			sd_dp->aborted = false;
 		}
@@ -7397,7 +7398,7 @@  static int scsi_debug_queuecommand(struct Scsi_Host *shost,
 					       (u32)cmd[k]);
 		}
 		sdev_printk(KERN_INFO, sdp, "%s: tag=%#x, cmd %s\n", my_name,
-			    blk_mq_unique_tag(scp->request), b);
+			    blk_mq_unique_tag(scsi_cmd_to_rq(scp)), b);
 	}
 	if (unlikely(inject_now && (sdebug_opts & SDEBUG_OPT_HOST_BUSY)))
 		return SCSI_MLQUEUE_HOST_BUSY;