All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd
@ 2021-08-09 23:03 Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
                   ` (53 more replies)
  0 siblings, 54 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche

Hi Martin,

This patch series implements the following two changes for all SCSI drivers:
- Use blk_mq_rq_from_pdu() instead of the request member of struct scsi_cmnd
  since adding an offset to a pointer is faster than pointer indirection.
- Remove the request pointer from struct scsi_cmnd.

Please consider this patch series for kernel v5.14.

Thanks,

Bart.

Changes compared to v4:
- Replaced the NCR5380 patch.
- Added several more Acked-by tags.

Changes compared to v3:
- Added several more Acked-by tags.
- Rebased this patch series.

Changes compared to v2:
- Added a patch for the aha1542 driver since a recent change introduced a
  scsi_cmnd.request dereference in that driver.
- In patch 2, renamed a local variable in a macro from 'rq' into '__rq'.  
- Added several more Acked-by tags.

Changes compared to v1:
- Renamed blk_req() into scsi_cmd_to_rq().
- Added several Acked-by tags.

Bart Van Assche (52):
  core: Introduce the scsi_cmd_to_rq() function
  core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  sd: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  sr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  scsi_transport_fc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  scsi_transport_spi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  ata: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  RDMA/iser: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  RDMA/srp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  zfcp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  53c700: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  NCR5380: Use sc_data_direction instead of rq_data_dir()
  aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  aha1542: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  bnx2i: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  csiostor: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  cxlflash: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  dpt_i2o: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  fnic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  hisi_sas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  hpsa: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  ibmvfc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  ibmvscsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  ips: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  libsas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  lpfc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  megaraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  mpi3mr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  mpt3sas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  mvumi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  myrb: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  myrs: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  ncr53c8xx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  qedf: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  qedi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  qla1280: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  qla4xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  qlogicpti: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  scsi_debug: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  smartpqi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  snic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  stex: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  sun3_scsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  sym53c8xx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  ufs: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  virtio_scsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  xen-scsifront: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  tcm_loop: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  usb-storage: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  core: Remove the request member from struct scsi_cmnd

 drivers/ata/libata-eh.c                     |  5 +-
 drivers/ata/libata-scsi.c                   | 10 +--
 drivers/ata/pata_falcon.c                   |  4 +-
 drivers/infiniband/ulp/iser/iser_memory.c   |  2 +-
 drivers/infiniband/ulp/srp/ib_srp.c         |  9 +--
 drivers/s390/scsi/zfcp_fsf.c                |  2 +-
 drivers/scsi/53c700.c                       |  2 +-
 drivers/scsi/NCR5380.c                      |  6 +-
 drivers/scsi/aacraid/aachba.c               |  2 +-
 drivers/scsi/aacraid/commsup.c              |  2 +-
 drivers/scsi/advansys.c                     |  4 +-
 drivers/scsi/aha1542.c                      |  6 +-
 drivers/scsi/bnx2i/bnx2i_hwi.c              |  2 +-
 drivers/scsi/csiostor/csio_scsi.c           |  6 +-
 drivers/scsi/cxlflash/main.c                |  2 +-
 drivers/scsi/dpt_i2o.c                      |  4 +-
 drivers/scsi/fnic/fnic_scsi.c               | 51 ++++++++-------
 drivers/scsi/hisi_sas/hisi_sas_main.c       |  4 +-
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c      |  2 +-
 drivers/scsi/hpsa.c                         |  6 +-
 drivers/scsi/ibmvscsi/ibmvfc.c              |  2 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c            |  2 +-
 drivers/scsi/ips.c                          |  2 +-
 drivers/scsi/libsas/sas_ata.c               |  2 +-
 drivers/scsi/libsas/sas_scsi_host.c         |  2 +-
 drivers/scsi/lpfc/lpfc_scsi.c               | 71 ++++++++++-----------
 drivers/scsi/megaraid/megaraid_sas_base.c   |  4 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 10 +--
 drivers/scsi/mpi3mr/mpi3mr_os.c             |  8 +--
 drivers/scsi/mpt3sas/mpt3sas_base.c         |  4 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c        |  6 +-
 drivers/scsi/mvumi.c                        |  2 +-
 drivers/scsi/myrb.c                         | 11 ++--
 drivers/scsi/myrs.c                         | 11 ++--
 drivers/scsi/ncr53c8xx.c                    |  4 +-
 drivers/scsi/qedf/qedf_io.c                 |  8 +--
 drivers/scsi/qedi/qedi_fw.c                 |  9 +--
 drivers/scsi/qla1280.c                      |  5 +-
 drivers/scsi/qla2xxx/qla_os.c               |  4 +-
 drivers/scsi/qla4xxx/ql4_iocb.c             |  2 +-
 drivers/scsi/qla4xxx/ql4_os.c               |  4 +-
 drivers/scsi/qlogicpti.c                    |  2 +-
 drivers/scsi/scsi.c                         |  2 +-
 drivers/scsi/scsi_debug.c                   | 13 ++--
 drivers/scsi/scsi_error.c                   | 16 ++---
 drivers/scsi/scsi_lib.c                     | 29 +++++----
 drivers/scsi/scsi_logging.c                 | 18 +++---
 drivers/scsi/scsi_transport_fc.c            |  2 +-
 drivers/scsi/scsi_transport_spi.c           |  2 +-
 drivers/scsi/sd.c                           | 33 +++++-----
 drivers/scsi/sd_zbc.c                       | 10 +--
 drivers/scsi/smartpqi/smartpqi_init.c       |  4 +-
 drivers/scsi/snic/snic_scsi.c               | 10 +--
 drivers/scsi/sr.c                           | 13 ++--
 drivers/scsi/stex.c                         |  6 +-
 drivers/scsi/sun3_scsi.c                    |  5 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c         |  4 +-
 drivers/scsi/ufs/ufshcd.c                   | 11 ++--
 drivers/scsi/ufs/ufshpb.c                   | 19 +++---
 drivers/scsi/virtio_scsi.c                  |  4 +-
 drivers/scsi/xen-scsifront.c                |  2 +-
 drivers/target/loopback/tcm_loop.c          |  4 +-
 drivers/usb/storage/transport.c             |  2 +-
 include/scsi/scsi_cmnd.h                    | 17 +++--
 include/scsi/scsi_device.h                  | 16 +++--
 65 files changed, 273 insertions(+), 275 deletions(-)


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:15   ` Hannes Reinecke
  2021-08-12 12:28   ` Christoph Hellwig
  2021-08-09 23:03 ` [PATCH v5 02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
                   ` (52 subsequent siblings)
  53 siblings, 2 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, James E.J. Bottomley

The 'request' member of struct scsi_cmnd is superfluous. The struct
request and struct scsi_cmnd data structures are adjacent and hence the
request pointer can be derived easily from a scsi_cmnd pointer. Introduce
a helper function that performs that conversion in a type-safe way. This
patch is the first step towards removing the request member from struct
scsi_cmnd. Making that change has the following advantages:
- This is a performance optimization since adding an offset to a pointer
  takes less time than dereferencing a pointer.
- struct scsi_cmnd becomes smaller.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/scsi/scsi_cmnd.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 90da9617d28a..e76278ea1fee 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -146,6 +146,12 @@ struct scsi_cmnd {
 	unsigned int extra_len;	/* length of alignment and padding */
 };
 
+/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */
+static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd)
+{
+	return blk_mq_rq_from_pdu(scmd);
+}
+
 /*
  * Return the driver private allocation behind the command.
  * Only works if cmd_size is set in the host template.

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:17   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 03/52] sd: " Bart Van Assche
                   ` (51 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. Cast away constness where necessary when passing a SCSI command
pointer to scsi_cmd_to_rq(). This patch does not change any functionality.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi.c         |  2 +-
 drivers/scsi/scsi_error.c   | 15 ++++++++-------
 drivers/scsi/scsi_lib.c     | 28 +++++++++++++++-------------
 drivers/scsi/scsi_logging.c | 18 ++++++++++--------
 include/scsi/scsi_cmnd.h    |  8 +++++---
 include/scsi/scsi_device.h  | 16 +++++++++-------
 6 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index d26025cf5de3..b241f9e3885c 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -190,7 +190,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
 				"(result %x)\n", cmd->result));
 
 	good_bytes = scsi_bufflen(cmd);
-	if (!blk_rq_is_passthrough(cmd->request)) {
+	if (!blk_rq_is_passthrough(scsi_cmd_to_rq(cmd))) {
 		int old_good_bytes = good_bytes;
 		drv = scsi_cmd_to_driver(cmd);
 		if (drv->done)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 58a252c38992..d85d308a0683 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -242,7 +242,7 @@ scsi_abort_command(struct scsi_cmnd *scmd)
  */
 static void scsi_eh_reset(struct scsi_cmnd *scmd)
 {
-	if (!blk_rq_is_passthrough(scmd->request)) {
+	if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) {
 		struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
 		if (sdrv->eh_reset)
 			sdrv->eh_reset(scmd);
@@ -1182,7 +1182,7 @@ static enum scsi_disposition scsi_request_sense(struct scsi_cmnd *scmd)
 static enum scsi_disposition
 scsi_eh_action(struct scsi_cmnd *scmd, enum scsi_disposition rtn)
 {
-	if (!blk_rq_is_passthrough(scmd->request)) {
+	if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) {
 		struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
 		if (sdrv->eh_action)
 			rtn = sdrv->eh_action(scmd, rtn);
@@ -1750,21 +1750,23 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q,
  */
 int scsi_noretry_cmd(struct scsi_cmnd *scmd)
 {
+	struct request *req = scsi_cmd_to_rq(scmd);
+
 	switch (host_byte(scmd->result)) {
 	case DID_OK:
 		break;
 	case DID_TIME_OUT:
 		goto check_type;
 	case DID_BUS_BUSY:
-		return (scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT);
+		return req->cmd_flags & REQ_FAILFAST_TRANSPORT;
 	case DID_PARITY:
-		return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
+		return req->cmd_flags & REQ_FAILFAST_DEV;
 	case DID_ERROR:
 		if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT)
 			return 0;
 		fallthrough;
 	case DID_SOFT_ERROR:
-		return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
+		return req->cmd_flags & REQ_FAILFAST_DRIVER;
 	}
 
 	if (!scsi_status_is_check_condition(scmd->result))
@@ -1775,8 +1777,7 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
 	 * assume caller has checked sense and determined
 	 * the check condition was retryable.
 	 */
-	if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
-	    blk_rq_is_passthrough(scmd->request))
+	if (req->cmd_flags & REQ_FAILFAST_DEV || blk_rq_is_passthrough(req))
 		return 1;
 
 	return 0;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 77578b221a71..909a422ec8f4 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -119,13 +119,15 @@ scsi_set_blocked(struct scsi_cmnd *cmd, int reason)
 
 static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)
 {
-	if (cmd->request->rq_flags & RQF_DONTPREP) {
-		cmd->request->rq_flags &= ~RQF_DONTPREP;
+	struct request *rq = scsi_cmd_to_rq(cmd);
+
+	if (rq->rq_flags & RQF_DONTPREP) {
+		rq->rq_flags &= ~RQF_DONTPREP;
 		scsi_mq_uninit_cmd(cmd);
 	} else {
 		WARN_ON_ONCE(true);
 	}
-	blk_mq_requeue_request(cmd->request, true);
+	blk_mq_requeue_request(rq, true);
 }
 
 /**
@@ -164,7 +166,7 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, bool unbusy)
 	 */
 	cmd->result = 0;
 
-	blk_mq_requeue_request(cmd->request, true);
+	blk_mq_requeue_request(scsi_cmd_to_rq(cmd), true);
 }
 
 /**
@@ -478,7 +480,7 @@ void scsi_run_host_queues(struct Scsi_Host *shost)
 
 static void scsi_uninit_cmd(struct scsi_cmnd *cmd)
 {
-	if (!blk_rq_is_passthrough(cmd->request)) {
+	if (!blk_rq_is_passthrough(scsi_cmd_to_rq(cmd))) {
 		struct scsi_driver *drv = scsi_cmd_to_driver(cmd);
 
 		if (drv->uninit_command)
@@ -624,7 +626,7 @@ static void scsi_io_completion_reprep(struct scsi_cmnd *cmd,
 
 static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd)
 {
-	struct request *req = cmd->request;
+	struct request *req = scsi_cmd_to_rq(cmd);
 	unsigned long wait_for;
 
 	if (cmd->allowed == SCSI_CMD_RETRIES_NO_LIMIT)
@@ -643,7 +645,7 @@ static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd)
 static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
 {
 	struct request_queue *q = cmd->device->request_queue;
-	struct request *req = cmd->request;
+	struct request *req = scsi_cmd_to_rq(cmd);
 	int level = 0;
 	enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,
 	      ACTION_DELAYED_RETRY} action;
@@ -818,7 +820,7 @@ static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result,
 {
 	bool sense_valid;
 	bool sense_current = true;	/* false implies "deferred sense" */
-	struct request *req = cmd->request;
+	struct request *req = scsi_cmd_to_rq(cmd);
 	struct scsi_sense_hdr sshdr;
 
 	sense_valid = scsi_command_normalize_sense(cmd, &sshdr);
@@ -907,7 +909,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 {
 	int result = cmd->result;
 	struct request_queue *q = cmd->device->request_queue;
-	struct request *req = cmd->request;
+	struct request *req = scsi_cmd_to_rq(cmd);
 	blk_status_t blk_stat = BLK_STS_OK;
 
 	if (unlikely(result))	/* a nz result may or may not be an error */
@@ -978,7 +980,7 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev,
 blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd)
 {
 	struct scsi_device *sdev = cmd->device;
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	unsigned short nr_segs = blk_rq_nr_phys_segments(rq);
 	struct scatterlist *last_sg = NULL;
 	blk_status_t ret;
@@ -1112,7 +1114,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
 {
 	void *buf = cmd->sense_buffer;
 	void *prot = cmd->prot_sdb;
-	struct request *rq = blk_mq_rq_from_pdu(cmd);
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	unsigned int flags = cmd->flags & SCMD_PRESERVED_FLAGS;
 	unsigned long jiffies_at_alloc;
 	int retries, to_clear;
@@ -1577,12 +1579,12 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
 
 static void scsi_mq_done(struct scsi_cmnd *cmd)
 {
-	if (unlikely(blk_should_fake_timeout(cmd->request->q)))
+	if (unlikely(blk_should_fake_timeout(scsi_cmd_to_rq(cmd)->q)))
 		return;
 	if (unlikely(test_and_set_bit(SCMD_STATE_COMPLETE, &cmd->state)))
 		return;
 	trace_scsi_dispatch_cmd_done(cmd);
-	blk_mq_complete_request(cmd->request);
+	blk_mq_complete_request(scsi_cmd_to_rq(cmd));
 }
 
 static void scsi_mq_put_budget(struct request_queue *q, int budget_token)
diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index 2317717935e9..ed9572252a42 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -28,8 +28,9 @@ static void scsi_log_release_buffer(char *bufptr)
 
 static inline const char *scmd_name(const struct scsi_cmnd *scmd)
 {
-	return scmd->request->rq_disk ?
-		scmd->request->rq_disk->disk_name : NULL;
+	struct request *rq = scsi_cmd_to_rq((struct scsi_cmnd *)scmd);
+
+	return rq->rq_disk ? rq->rq_disk->disk_name : NULL;
 }
 
 static size_t sdev_format_header(char *logbuf, size_t logbuf_len,
@@ -91,7 +92,7 @@ void scmd_printk(const char *level, const struct scsi_cmnd *scmd,
 	if (!logbuf)
 		return;
 	off = sdev_format_header(logbuf, logbuf_len, scmd_name(scmd),
-				 scmd->request->tag);
+				 scsi_cmd_to_rq((struct scsi_cmnd *)scmd)->tag);
 	if (off < logbuf_len) {
 		va_start(args, fmt);
 		off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
@@ -188,7 +189,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
 		return;
 
 	off = sdev_format_header(logbuf, logbuf_len,
-				 scmd_name(cmd), cmd->request->tag);
+				 scmd_name(cmd), scsi_cmd_to_rq(cmd)->tag);
 	if (off >= logbuf_len)
 		goto out_printk;
 	off += scnprintf(logbuf + off, logbuf_len - off, "CDB: ");
@@ -210,7 +211,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
 
 			off = sdev_format_header(logbuf, logbuf_len,
 						 scmd_name(cmd),
-						 cmd->request->tag);
+						 scsi_cmd_to_rq(cmd)->tag);
 			if (!WARN_ON(off > logbuf_len - 58)) {
 				off += scnprintf(logbuf + off, logbuf_len - off,
 						 "CDB[%02x]: ", k);
@@ -373,7 +374,8 @@ EXPORT_SYMBOL(__scsi_print_sense);
 /* Normalize and print sense buffer in SCSI command */
 void scsi_print_sense(const struct scsi_cmnd *cmd)
 {
-	scsi_log_print_sense(cmd->device, scmd_name(cmd), cmd->request->tag,
+	scsi_log_print_sense(cmd->device, scmd_name(cmd),
+			     scsi_cmd_to_rq((struct scsi_cmnd *)cmd)->tag,
 			     cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
 }
 EXPORT_SYMBOL(scsi_print_sense);
@@ -391,8 +393,8 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
 	if (!logbuf)
 		return;
 
-	off = sdev_format_header(logbuf, logbuf_len,
-				 scmd_name(cmd), cmd->request->tag);
+	off = sdev_format_header(logbuf, logbuf_len, scmd_name(cmd),
+				 scsi_cmd_to_rq((struct scsi_cmnd *)cmd)->tag);
 
 	if (off >= logbuf_len)
 		goto out_printk;
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index e76278ea1fee..b9265b15d37a 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -164,7 +164,9 @@ static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
 /* make sure not to use it with passthrough commands */
 static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
 {
-	return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
+	struct request *rq = scsi_cmd_to_rq(cmd);
+
+	return *(struct scsi_driver **)rq->rq_disk->private_data;
 }
 
 extern void scsi_finish_command(struct scsi_cmnd *cmd);
@@ -228,14 +230,14 @@ static inline int scsi_sg_copy_to_buffer(struct scsi_cmnd *cmd,
 
 static inline sector_t scsi_get_sector(struct scsi_cmnd *scmd)
 {
-	return blk_rq_pos(scmd->request);
+	return blk_rq_pos(scsi_cmd_to_rq(scmd));
 }
 
 static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
 {
 	unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
 
-	return blk_rq_pos(scmd->request) >> shift;
+	return blk_rq_pos(scsi_cmd_to_rq(scmd)) >> shift;
 }
 
 /*
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 7137e7924913..09a17f6e93a7 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -271,13 +271,15 @@ sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
 __printf(3, 4) void
 scmd_printk(const char *, const struct scsi_cmnd *, const char *, ...);
 
-#define scmd_dbg(scmd, fmt, a...)					   \
-	do {								   \
-		if ((scmd)->request->rq_disk)				   \
-			sdev_dbg((scmd)->device, "[%s] " fmt,		   \
-				 (scmd)->request->rq_disk->disk_name, ##a);\
-		else							   \
-			sdev_dbg((scmd)->device, fmt, ##a);		   \
+#define scmd_dbg(scmd, fmt, a...)					\
+	do {								\
+		struct request *__rq = scsi_cmd_to_rq((scmd));		\
+									\
+		if (__rq->rq_disk)					\
+			sdev_dbg((scmd)->device, "[%s] " fmt,		\
+				 __rq->rq_disk->disk_name, ##a);	\
+		else							\
+			sdev_dbg((scmd)->device, fmt, ##a);		\
 	} while (0)
 
 enum scsi_target_state {

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 03/52] sd: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:18   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 04/52] sr: " Bart Van Assche
                   ` (50 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/sd.c     | 33 +++++++++++++++++----------------
 drivers/scsi/sd_zbc.c | 10 +++++-----
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index c1b75f159e0c..ac431b0477da 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -776,8 +776,9 @@ static unsigned int sd_prot_flag_mask(unsigned int prot_op)
 static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd,
 					   unsigned int dix, unsigned int dif)
 {
-	struct bio *bio = scmd->request->bio;
-	unsigned int prot_op = sd_prot_op(rq_data_dir(scmd->request), dix, dif);
+	struct request *rq = scsi_cmd_to_rq(scmd);
+	struct bio *bio = rq->bio;
+	unsigned int prot_op = sd_prot_op(rq_data_dir(rq), dix, dif);
 	unsigned int protect = 0;
 
 	if (dix) {				/* DIX Type 0, 1, 2, 3 */
@@ -868,7 +869,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
 static blk_status_t sd_setup_unmap_cmnd(struct scsi_cmnd *cmd)
 {
 	struct scsi_device *sdp = cmd->device;
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	u64 lba = sectors_to_logical(sdp, blk_rq_pos(rq));
 	u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
@@ -904,7 +905,7 @@ static blk_status_t sd_setup_write_same16_cmnd(struct scsi_cmnd *cmd,
 		bool unmap)
 {
 	struct scsi_device *sdp = cmd->device;
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	u64 lba = sectors_to_logical(sdp, blk_rq_pos(rq));
 	u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
@@ -936,7 +937,7 @@ static blk_status_t sd_setup_write_same10_cmnd(struct scsi_cmnd *cmd,
 		bool unmap)
 {
 	struct scsi_device *sdp = cmd->device;
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	u64 lba = sectors_to_logical(sdp, blk_rq_pos(rq));
 	u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
@@ -966,7 +967,7 @@ static blk_status_t sd_setup_write_same10_cmnd(struct scsi_cmnd *cmd,
 
 static blk_status_t sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_device *sdp = cmd->device;
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	u64 lba = sectors_to_logical(sdp, blk_rq_pos(rq));
@@ -1063,7 +1064,7 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
  **/
 static blk_status_t sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_device *sdp = cmd->device;
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	struct bio *bio = rq->bio;
@@ -1112,7 +1113,7 @@ static blk_status_t sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
 
 static blk_status_t sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 
 	/* flush requests don't perform I/O, zero the S/G table */
@@ -1210,7 +1211,7 @@ static blk_status_t sd_setup_rw6_cmnd(struct scsi_cmnd *cmd, bool write,
 
 static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_device *sdp = cmd->device;
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));
@@ -1324,7 +1325,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
 
 static blk_status_t sd_init_command(struct scsi_cmnd *cmd)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 
 	switch (req_op(rq)) {
 	case REQ_OP_DISCARD:
@@ -1370,7 +1371,7 @@ static blk_status_t sd_init_command(struct scsi_cmnd *cmd)
 
 static void sd_uninit_command(struct scsi_cmnd *SCpnt)
 {
-	struct request *rq = SCpnt->request;
+	struct request *rq = scsi_cmd_to_rq(SCpnt);
 	u8 *cmnd;
 
 	if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)
@@ -1875,7 +1876,7 @@ static const struct block_device_operations sd_fops = {
  **/
 static void sd_eh_reset(struct scsi_cmnd *scmd)
 {
-	struct scsi_disk *sdkp = scsi_disk(scmd->request->rq_disk);
+	struct scsi_disk *sdkp = scsi_disk(scsi_cmd_to_rq(scmd)->rq_disk);
 
 	/* New SCSI EH run, reset gate variable */
 	sdkp->ignore_medium_access_errors = false;
@@ -1895,7 +1896,7 @@ static void sd_eh_reset(struct scsi_cmnd *scmd)
  **/
 static int sd_eh_action(struct scsi_cmnd *scmd, int eh_disp)
 {
-	struct scsi_disk *sdkp = scsi_disk(scmd->request->rq_disk);
+	struct scsi_disk *sdkp = scsi_disk(scsi_cmd_to_rq(scmd)->rq_disk);
 	struct scsi_device *sdev = scmd->device;
 
 	if (!scsi_device_online(sdev) ||
@@ -1936,7 +1937,7 @@ static int sd_eh_action(struct scsi_cmnd *scmd, int eh_disp)
 
 static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
 {
-	struct request *req = scmd->request;
+	struct request *req = scsi_cmd_to_rq(scmd);
 	struct scsi_device *sdev = scmd->device;
 	unsigned int transferred, good_bytes;
 	u64 start_lba, end_lba, bad_lba;
@@ -1991,8 +1992,8 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 	unsigned int sector_size = SCpnt->device->sector_size;
 	unsigned int resid;
 	struct scsi_sense_hdr sshdr;
-	struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk);
-	struct request *req = SCpnt->request;
+	struct request *req = scsi_cmd_to_rq(SCpnt);
+	struct scsi_disk *sdkp = scsi_disk(req->rq_disk);
 	int sense_valid = 0;
 	int sense_deferred = 0;
 
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 186b5ff52c3a..b9757f24b0d6 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -243,7 +243,7 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
 
 static blk_status_t sd_zbc_cmnd_checks(struct scsi_cmnd *cmd)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	sector_t sector = blk_rq_pos(rq);
 
@@ -321,7 +321,7 @@ static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
 blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
 					unsigned int nr_blocks)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	unsigned int wp_offset, zno = blk_rq_zone_no(rq);
 	unsigned long flags;
@@ -386,7 +386,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
 blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd,
 					 unsigned char op, bool all)
 {
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	sector_t sector = blk_rq_pos(rq);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	sector_t block = sectors_to_logical(sdkp->device, sector);
@@ -442,7 +442,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd,
 					  unsigned int good_bytes)
 {
 	int result = cmd->result;
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
 	unsigned int zno = blk_rq_zone_no(rq);
 	enum req_opf op = req_op(rq);
@@ -516,7 +516,7 @@ unsigned int sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
 		     struct scsi_sense_hdr *sshdr)
 {
 	int result = cmd->result;
-	struct request *rq = cmd->request;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 
 	if (op_is_zone_mgmt(req_op(rq)) &&
 	    result &&

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 04/52] sr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (2 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 03/52] sd: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:18   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 05/52] scsi_transport_fc: " Bart Van Assche
                   ` (49 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, Jens Axboe, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/sr.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 6203a8b58d40..6a96151d3630 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -331,7 +331,8 @@ static int sr_done(struct scsi_cmnd *SCpnt)
 	int good_bytes = (result == 0 ? this_count : 0);
 	int block_sectors = 0;
 	long error_sector;
-	struct scsi_cd *cd = scsi_cd(SCpnt->request->rq_disk);
+	struct request *rq = scsi_cmd_to_rq(SCpnt);
+	struct scsi_cd *cd = scsi_cd(rq->rq_disk);
 
 #ifdef DEBUG
 	scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result);
@@ -353,16 +354,14 @@ static int sr_done(struct scsi_cmnd *SCpnt)
 				break;
 			error_sector =
 				get_unaligned_be32(&SCpnt->sense_buffer[3]);
-			if (SCpnt->request->bio != NULL)
-				block_sectors =
-					bio_sectors(SCpnt->request->bio);
+			if (rq->bio != NULL)
+				block_sectors = bio_sectors(rq->bio);
 			if (block_sectors < 4)
 				block_sectors = 4;
 			if (cd->device->sector_size == 2048)
 				error_sector <<= 2;
 			error_sector &= ~(block_sectors - 1);
-			good_bytes = (error_sector -
-				      blk_rq_pos(SCpnt->request)) << 9;
+			good_bytes = (error_sector - blk_rq_pos(rq)) << 9;
 			if (good_bytes < 0 || good_bytes >= this_count)
 				good_bytes = 0;
 			/*
@@ -394,7 +393,7 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
 {
 	int block = 0, this_count, s_size;
 	struct scsi_cd *cd;
-	struct request *rq = SCpnt->request;
+	struct request *rq = scsi_cmd_to_rq(SCpnt);
 	blk_status_t ret;
 
 	ret = scsi_alloc_sgtables(SCpnt);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 05/52] scsi_transport_fc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (3 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 04/52] sr: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:19   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 06/52] scsi_transport_spi: " Bart Van Assche
                   ` (48 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_transport_fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 49748cd817a5..60e406bcf42a 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3804,7 +3804,7 @@ bool fc_eh_should_retry_cmd(struct scsi_cmnd *scmd)
 	struct fc_rport *rport = starget_to_rport(scsi_target(scmd->device));
 
 	if ((rport->port_state != FC_PORTSTATE_ONLINE) &&
-		(scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT)) {
+		(scsi_cmd_to_rq(scmd)->cmd_flags & REQ_FAILFAST_TRANSPORT)) {
 		set_host_byte(scmd, DID_TRANSPORT_MARGINAL);
 		return false;
 	}

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 06/52] scsi_transport_spi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (4 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 05/52] scsi_transport_fc: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:19   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 07/52] ata: " Bart Van Assche
                   ` (47 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_transport_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 5af7a10e9514..bd72c38d7bfc 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1230,7 +1230,7 @@ int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd)
 {
         if (cmd->flags & SCMD_TAGGED) {
 		*msg++ = SIMPLE_QUEUE_TAG;
-        	*msg++ = cmd->request->tag;
+		*msg++ = scsi_cmd_to_rq(cmd)->tag;
         	return 2;
 	}
 

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 07/52] ata: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (5 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 06/52] scsi_transport_spi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:20   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 08/52] RDMA/iser: " Bart Van Assche
                   ` (46 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Jens Axboe, Christoph Hellwig,
	Hannes Reinecke, Ming Lei

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ata/libata-eh.c   |  5 ++---
 drivers/ata/libata-scsi.c | 10 +++++-----
 drivers/ata/pata_falcon.c |  4 ++--
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index bb3637762985..bf9c4b6c5c3d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -912,7 +912,7 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
 	 * Note that ATA_QCFLAG_FAILED is unconditionally set after
 	 * this function completes.
 	 */
-	blk_abort_request(qc->scsicmd->request);
+	blk_abort_request(scsi_cmd_to_rq(qc->scsicmd));
 }
 
 /**
@@ -1893,8 +1893,7 @@ static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc)
  */
 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc)
 {
-	if (qc->scsicmd &&
-	    qc->scsicmd->request->rq_flags & RQF_QUIET)
+	if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET)
 		qc->flags |= ATA_QCFLAG_QUIET;
 	return qc->flags & ATA_QCFLAG_QUIET;
 }
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b9588c52815d..f7f630485465 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -631,7 +631,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
 {
 	struct ata_queued_cmd *qc;
 
-	qc = ata_qc_new_init(dev, cmd->request->tag);
+	qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
 	if (qc) {
 		qc->scsicmd = cmd;
 		qc->scsidone = cmd->scsi_done;
@@ -639,7 +639,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
 		qc->sg = scsi_sglist(cmd);
 		qc->n_elem = scsi_sg_count(cmd);
 
-		if (cmd->request->rq_flags & RQF_QUIET)
+		if (scsi_cmd_to_rq(cmd)->rq_flags & RQF_QUIET)
 			qc->flags |= ATA_QCFLAG_QUIET;
 	} else {
 		cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
@@ -1496,7 +1496,7 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc)
 
 static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks)
 {
-	struct request *rq = scmd->request;
+	struct request *rq = scsi_cmd_to_rq(scmd);
 	u32 req_blocks;
 
 	if (!blk_rq_is_passthrough(rq))
@@ -1531,7 +1531,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
 {
 	struct scsi_cmnd *scmd = qc->scsicmd;
 	const u8 *cdb = scmd->cmnd;
-	struct request *rq = scmd->request;
+	struct request *rq = scsi_cmd_to_rq(scmd);
 	int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
 	unsigned int tf_flags = 0;
 	u64 block;
@@ -3181,7 +3181,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
 	 * as it modifies the DATA OUT buffer, which would corrupt user
 	 * memory for SG_IO commands.
 	 */
-	if (unlikely(blk_rq_is_passthrough(scmd->request)))
+	if (unlikely(blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))))
 		goto invalid_opcode;
 
 	if (unlikely(scmd->cmd_len < 16)) {
diff --git a/drivers/ata/pata_falcon.c b/drivers/ata/pata_falcon.c
index 9d0dd8f4c21c..121635aa8c00 100644
--- a/drivers/ata/pata_falcon.c
+++ b/drivers/ata/pata_falcon.c
@@ -48,8 +48,8 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,
 	struct scsi_cmnd *cmd = qc->scsicmd;
 	bool swap = 1;
 
-	if (dev->class == ATA_DEV_ATA && cmd && cmd->request &&
-	    !blk_rq_is_passthrough(cmd->request))
+	if (dev->class == ATA_DEV_ATA && cmd &&
+	    !blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)))
 		swap = 0;
 
 	/* Transfer multiple of 2 bytes */

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 08/52] RDMA/iser: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (6 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 07/52] ata: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:20   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 09/52] RDMA/srp: " Bart Van Assche
                   ` (45 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Max Gurtovoy, Sagi Grimberg,
	Doug Ledford, Jason Gunthorpe

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/infiniband/ulp/iser/iser_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index afec40da9b58..9776b755d848 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -159,7 +159,7 @@ iser_set_dif_domain(struct scsi_cmnd *sc, struct ib_sig_domain *domain)
 {
 	domain->sig_type = IB_SIG_TYPE_T10_DIF;
 	domain->sig.dif.pi_interval = scsi_prot_interval(sc);
-	domain->sig.dif.ref_tag = t10_pi_ref_tag(sc->request);
+	domain->sig.dif.ref_tag = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
 	/*
 	 * At the moment we hard code those, but in the future
 	 * we will take them from sc.

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 09/52] RDMA/srp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (7 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 08/52] RDMA/iser: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:21   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 10/52] zfcp: " Bart Van Assche
                   ` (44 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Doug Ledford, Jason Gunthorpe

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/infiniband/ulp/srp/ib_srp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 8d5cf5eb5778..71eda91e810c 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1280,7 +1280,7 @@ static bool srp_terminate_cmd(struct scsi_cmnd *scmnd, void *context_ptr,
 {
 	struct srp_terminate_context *context = context_ptr;
 	struct srp_target_port *target = context->srp_target;
-	u32 tag = blk_mq_unique_tag(scmnd->request);
+	u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd));
 	struct srp_rdma_ch *ch = &target->ch[blk_mq_unique_tag_to_hwq(tag)];
 	struct srp_request *req = scsi_cmd_priv(scmnd);
 
@@ -2152,6 +2152,7 @@ static void srp_handle_qp_err(struct ib_cq *cq, struct ib_wc *wc,
 
 static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
 {
+	struct request *rq = scsi_cmd_to_rq(scmnd);
 	struct srp_target_port *target = host_to_target(shost);
 	struct srp_rdma_ch *ch;
 	struct srp_request *req = scsi_cmd_priv(scmnd);
@@ -2166,8 +2167,8 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
 	if (unlikely(scmnd->result))
 		goto err;
 
-	WARN_ON_ONCE(scmnd->request->tag < 0);
-	tag = blk_mq_unique_tag(scmnd->request);
+	WARN_ON_ONCE(rq->tag < 0);
+	tag = blk_mq_unique_tag(rq);
 	ch = &target->ch[blk_mq_unique_tag_to_hwq(tag)];
 
 	spin_lock_irqsave(&ch->lock, flags);
@@ -2791,7 +2792,7 @@ static int srp_abort(struct scsi_cmnd *scmnd)
 
 	if (!req)
 		return SUCCESS;
-	tag = blk_mq_unique_tag(scmnd->request);
+	tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd));
 	ch_idx = blk_mq_unique_tag_to_hwq(tag);
 	if (WARN_ON_ONCE(ch_idx >= target->ch_count))
 		return SUCCESS;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 10/52] zfcp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (8 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 09/52] RDMA/srp: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:21   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 11/52] 53c700: " Bart Van Assche
                   ` (43 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Benjamin Block, Steffen Maier,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Acked-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/s390/scsi/zfcp_fsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 1990216cf289..6da8f6d05d39 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2377,7 +2377,7 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
 		}
 	}
 
-	blk_add_driver_data(scsi->request, &blktrc, sizeof(blktrc));
+	blk_add_driver_data(scsi_cmd_to_rq(scsi), &blktrc, sizeof(blktrc));
 }
 
 /**

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 11/52] 53c700: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (9 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 10/52] zfcp: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:21   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 12/52] NCR5380: Use sc_data_direction instead of rq_data_dir() Bart Van Assche
                   ` (42 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

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/53c700.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 1c6b4e672687..a12e3525977d 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1823,7 +1823,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
 
 	if ((hostdata->tag_negotiated & (1<<scmd_id(SCp))) &&
 	    SCp->device->simple_tags) {
-		slot->tag = SCp->request->tag;
+		slot->tag = scsi_cmd_to_rq(SCp)->tag;
 		CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n",
 		       slot->tag, slot);
 	} else {

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 12/52] NCR5380: Use sc_data_direction instead of rq_data_dir()
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (10 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 11/52] 53c700: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:22   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
                   ` (41 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Finn Thain, Michael Schmitz,
	James E.J. Bottomley

This patch prepares for the removal of the request pointer from struct
scsi_cmnd and does not change any functionality.

Suggested-by: Finn Thain <fthain@linux-m68k.org>
Acked-by: Finn Thain <fthain@linux-m68k.org>
Cc: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/NCR5380.c   | 6 +++---
 drivers/scsi/sun3_scsi.c | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 3baadd068768..a85589a2a8af 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -778,7 +778,7 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)
 	}
 
 #ifdef CONFIG_SUN3
-	if ((sun3scsi_dma_finish(rq_data_dir(hostdata->connected->request)))) {
+	if (sun3scsi_dma_finish(hostdata->connected->sc_data_direction)) {
 		pr_err("scsi%d: overrun in UDC counter -- not prepared to deal with this!\n",
 		       instance->host_no);
 		BUG();
@@ -1710,7 +1710,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
 				count = sun3scsi_dma_xfer_len(hostdata, cmd);
 
 				if (count > 0) {
-					if (rq_data_dir(cmd->request))
+					if (cmd->sc_data_direction == DMA_TO_DEVICE)
 						sun3scsi_dma_send_setup(hostdata,
 						                        cmd->SCp.ptr, count);
 					else
@@ -2158,7 +2158,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
 		count = sun3scsi_dma_xfer_len(hostdata, tmp);
 
 		if (count > 0) {
-			if (rq_data_dir(tmp->request))
+			if (tmp->sc_data_direction == DMA_TO_DEVICE)
 				sun3scsi_dma_send_setup(hostdata,
 				                        tmp->SCp.ptr, count);
 			else
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index 2e3fbc2fae97..9ed0bb7ecece 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -366,8 +366,9 @@ static inline int sun3scsi_dma_start(unsigned long count, unsigned char *data)
 }
 
 /* clean up after our dma is done */
-static int sun3scsi_dma_finish(int write_flag)
+static int sun3scsi_dma_finish(enum dma_data_direction data_dir)
 {
+	const bool write_flag = data_dir == DMA_TO_DEVICE;
 	unsigned short __maybe_unused count;
 	unsigned short fifo;
 	int ret = 0;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (11 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 12/52] NCR5380: Use sc_data_direction instead of rq_data_dir() Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:23   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 14/52] advansys: " Bart Van Assche
                   ` (40 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
	James E.J. Bottomley

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/aacraid/aachba.c  | 2 +-
 drivers/scsi/aacraid/commsup.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 267934d2f14b..c2d6f0a9e0b1 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1504,7 +1504,7 @@ static struct aac_srb * aac_scsi_common(struct fib * fib, struct scsi_cmnd * cmd
 	srbcmd->id       = cpu_to_le32(scmd_id(cmd));
 	srbcmd->lun      = cpu_to_le32(cmd->device->lun);
 	srbcmd->flags    = cpu_to_le32(flag);
-	timeout = cmd->request->timeout/HZ;
+	timeout = scsi_cmd_to_rq(cmd)->timeout / HZ;
 	if (timeout == 0)
 		timeout = (dev->sa_firmware ? AAC_SA_TIMEOUT : AAC_ARC_TIMEOUT);
 	srbcmd->timeout  = cpu_to_le32(timeout);  // timeout in seconds
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 54eb4d41bc2c..deb32c9f4b3e 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -224,7 +224,7 @@ struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
 {
 	struct fib *fibptr;
 
-	fibptr = &dev->fibs[scmd->request->tag];
+	fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag];
 	/*
 	 *	Null out fields that depend on being zero at the start of
 	 *	each I/O

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (12 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:25   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 15/52] aha1542: " Bart Van Assche
                   ` (39 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Matthew Wilcox, Hannes Reinecke,
	James E.J. Bottomley

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/advansys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index f3377e2ef5fb..ffb391967573 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7423,7 +7423,7 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
 	 * Set the srb_tag to the command tag + 1, as
 	 * srb_tag '0' is used internally by the chip.
 	 */
-	srb_tag = scp->request->tag + 1;
+	srb_tag = scsi_cmd_to_rq(scp)->tag + 1;
 	asc_scsi_q->q2.srb_tag = srb_tag;
 
 	/*
@@ -7637,7 +7637,7 @@ static int
 adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
 	      adv_req_t **adv_reqpp)
 {
-	u32 srb_tag = scp->request->tag;
+	u32 srb_tag = scsi_cmd_to_rq(scp)->tag;
 	adv_req_t *reqp;
 	ADV_SCSI_REQ_Q *scsiqp;
 	int ret;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 15/52] aha1542: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (13 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 14/52] advansys: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:25   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 16/52] bnx2i: " Bart Van Assche
                   ` (38 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

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/aha1542.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 1210e61afb18..584a59522038 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -262,11 +262,12 @@ static void aha1542_free_cmd(struct scsi_cmnd *cmd)
 	struct aha1542_cmd *acmd = scsi_cmd_priv(cmd);
 
 	if (cmd->sc_data_direction == DMA_FROM_DEVICE) {
+		struct request *rq = scsi_cmd_to_rq(cmd);
 		void *buf = acmd->data_buffer;
 		struct req_iterator iter;
 		struct bio_vec bv;
 
-		rq_for_each_segment(bv, cmd->request, iter) {
+		rq_for_each_segment(bv, rq, iter) {
 			memcpy_to_page(bv.bv_page, bv.bv_offset, buf,
 				       bv.bv_len);
 			buf += bv.bv_len;
@@ -447,11 +448,12 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 #endif
 
 	if (cmd->sc_data_direction == DMA_TO_DEVICE) {
+		struct request *rq = scsi_cmd_to_rq(cmd);
 		void *buf = acmd->data_buffer;
 		struct req_iterator iter;
 		struct bio_vec bv;
 
-		rq_for_each_segment(bv, cmd->request, iter) {
+		rq_for_each_segment(bv, rq, iter) {
 			memcpy_from_page(buf, bv.bv_page, bv.bv_offset,
 					 bv.bv_len);
 			buf += bv.bv_len;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 16/52] bnx2i: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (14 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 15/52] aha1542: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:26   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 17/52] csiostor: " Bart Van Assche
                   ` (37 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Nilesh Javali, Manish Rangankar,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley

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/bnx2i/bnx2i_hwi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 43e8a1dafec0..5521469ce678 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1918,7 +1918,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session,
 
 	spin_unlock(&session->back_lock);
 
-	p = &per_cpu(bnx2i_percpu, blk_mq_rq_cpu(sc->request));
+	p = &per_cpu(bnx2i_percpu, blk_mq_rq_cpu(scsi_cmd_to_rq(sc)));
 	spin_lock(&p->p_work_lock);
 	if (unlikely(!p->iothread)) {
 		rc = -EINVAL;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 17/52] csiostor: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (15 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 16/52] bnx2i: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:26   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 18/52] cxlflash: " Bart Van Assche
                   ` (36 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley,
	Colin Ian King, Jiapeng Chong

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/csiostor/csio_scsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 56b9ad0a1ca0..3b2eb6ce1fcf 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1786,7 +1786,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)
 	struct csio_scsi_qset *sqset;
 	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
 
-	sqset = &hw->sqset[ln->portid][blk_mq_rq_cpu(cmnd->request)];
+	sqset = &hw->sqset[ln->portid][blk_mq_rq_cpu(scsi_cmd_to_rq(cmnd))];
 
 	nr = fc_remote_port_chkready(rport);
 	if (nr) {
@@ -1989,13 +1989,13 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
 		csio_info(hw,
 			"Aborted SCSI command to (%d:%llu) tag %u\n",
 			cmnd->device->id, cmnd->device->lun,
-			cmnd->request->tag);
+			scsi_cmd_to_rq(cmnd)->tag);
 		return SUCCESS;
 	} else {
 		csio_info(hw,
 			"Failed to abort SCSI command, (%d:%llu) tag %u\n",
 			cmnd->device->id, cmnd->device->lun,
-			cmnd->request->tag);
+			scsi_cmd_to_rq(cmnd)->tag);
 		return FAILED;
 	}
 }

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 18/52] cxlflash: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (16 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 17/52] csiostor: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  6:27   ` Hannes Reinecke
  2021-08-09 23:03 ` [PATCH v5 19/52] dpt_i2o: " Bart Van Assche
                   ` (35 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Manoj N. Kumar, Matthew R. Ochs,
	Uma Krishnan, James E.J. Bottomley

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/cxlflash/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 222593bc2afe..2f1894588e0b 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -433,7 +433,7 @@ static u32 cmd_to_target_hwq(struct Scsi_Host *host, struct scsi_cmnd *scp,
 		hwq = afu->hwq_rr_count++ % afu->num_hwqs;
 		break;
 	case HWQ_MODE_TAG:
-		tag = blk_mq_unique_tag(scp->request);
+		tag = blk_mq_unique_tag(scsi_cmd_to_rq(scp));
 		hwq = blk_mq_unique_tag_to_hwq(tag);
 		break;
 	case HWQ_MODE_CPU:

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 19/52] dpt_i2o: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (17 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 18/52] cxlflash: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 20/52] fnic: " Bart Van Assche
                   ` (34 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
	James E.J. Bottomley

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/dpt_i2o.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index a18a4a08f049..7af96d14c9bc 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -652,7 +652,7 @@ static int adpt_abort(struct scsi_cmnd * cmd)
 	msg[2] = 0;
 	msg[3]= 0;
 	/* Add 1 to avoid firmware treating it as invalid command */
-	msg[4] = cmd->request->tag + 1;
+	msg[4] = scsi_cmd_to_rq(cmd)->tag + 1;
 	if (pHba->host)
 		spin_lock_irq(pHba->host->host_lock);
 	rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
@@ -2236,7 +2236,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
 	msg[1] = ((0xff<<24)|(HOST_TID<<12)|d->tid);
 	msg[2] = 0;
 	/* Add 1 to avoid firmware treating it as invalid command */
-	msg[3] = cmd->request->tag + 1;
+	msg[3] = scsi_cmd_to_rq(cmd)->tag + 1;
 	// Our cards use the transaction context as the tag for queueing
 	// Adaptec/DPT Private stuff 
 	msg[4] = I2O_CMD_SCSI_EXEC|(DPT_ORGANIZATION_ID<<16);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 20/52] fnic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (18 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 19/52] dpt_i2o: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 21/52] hisi_sas: " Bart Van Assche
                   ` (33 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Satish Kharat, Sesidhar Baddela,
	Karan Tilak Kumar, James E.J. Bottomley

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/fnic/fnic_scsi.c | 51 +++++++++++++++++------------------
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 762cc8bd2653..0f9cedf78872 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -107,7 +107,7 @@ static void fnic_cleanup_io(struct fnic *fnic);
 static inline spinlock_t *fnic_io_lock_hash(struct fnic *fnic,
 					    struct scsi_cmnd *sc)
 {
-	u32 hash = sc->request->tag & (FNIC_IO_LOCKS - 1);
+	u32 hash = scsi_cmd_to_rq(sc)->tag & (FNIC_IO_LOCKS - 1);
 
 	return &fnic->io_req_lock[hash];
 }
@@ -390,7 +390,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
 	    (rp->flags & FC_RP_FLAGS_RETRY))
 		exch_flags |= FCPIO_ICMND_SRFLAG_RETRY;
 
-	fnic_queue_wq_copy_desc_icmnd_16(wq, sc->request->tag,
+	fnic_queue_wq_copy_desc_icmnd_16(wq, scsi_cmd_to_rq(sc)->tag,
 					 0, exch_flags, io_req->sgl_cnt,
 					 SCSI_SENSE_BUFFERSIZE,
 					 io_req->sgl_list_pa,
@@ -422,6 +422,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
  */
 static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
 {
+	const int tag = scsi_cmd_to_rq(sc)->tag;
 	struct fc_lport *lp = shost_priv(sc->device->host);
 	struct fc_rport *rport;
 	struct fnic_io_req *io_req = NULL;
@@ -511,8 +512,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
 	sg_count = scsi_dma_map(sc);
 	if (sg_count < 0) {
 		FNIC_TRACE(fnic_queuecommand, sc->device->host->host_no,
-			  sc->request->tag, sc, 0, sc->cmnd[0],
-			  sg_count, CMD_STATE(sc));
+			  tag, sc, 0, sc->cmnd[0], sg_count, CMD_STATE(sc));
 		mempool_free(io_req, fnic->io_req_pool);
 		goto out;
 	}
@@ -571,7 +571,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
 		 * refetch the pointer under the lock.
 		 */
 		FNIC_TRACE(fnic_queuecommand, sc->device->host->host_no,
-			  sc->request->tag, sc, 0, 0, 0,
+			  tag, sc, 0, 0, 0,
 			  (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
 		io_req = (struct fnic_io_req *)CMD_SP(sc);
 		CMD_SP(sc) = NULL;
@@ -603,8 +603,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
 			sc->cmnd[5]);
 
 	FNIC_TRACE(fnic_queuecommand, sc->device->host->host_no,
-		  sc->request->tag, sc, io_req,
-		  sg_count, cmd_trace,
+		  tag, sc, io_req, sg_count, cmd_trace,
 		  (((u64)CMD_FLAGS(sc) >> 32) | CMD_STATE(sc)));
 
 	/* if only we issued IO, will we have the io lock */
@@ -1364,6 +1363,7 @@ int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do)
 static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
 				 bool reserved)
 {
+	const int tag = scsi_cmd_to_rq(sc)->tag;
 	struct fnic *fnic = data;
 	struct fnic_io_req *io_req;
 	unsigned long flags = 0;
@@ -1371,7 +1371,7 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
 	unsigned long start_time = 0;
 	struct fnic_stats *fnic_stats = &fnic->fnic_stats;
 
-	io_lock = fnic_io_lock_tag(fnic, sc->request->tag);
+	io_lock = fnic_io_lock_tag(fnic, tag);
 	spin_lock_irqsave(io_lock, flags);
 
 	io_req = (struct fnic_io_req *)CMD_SP(sc);
@@ -1413,7 +1413,7 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
 	sc->result = DID_TRANSPORT_DISRUPTED << 16;
 	FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
 		      "fnic_cleanup_io: tag:0x%x : sc:0x%p duration = %lu DID_TRANSPORT_DISRUPTED\n",
-		      sc->request->tag, sc, (jiffies - start_time));
+		      tag, sc, jiffies - start_time);
 
 	if (atomic64_read(&fnic->io_cmpl_skip))
 		atomic64_dec(&fnic->io_cmpl_skip);
@@ -1425,10 +1425,10 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
 		if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED))
 			shost_printk(KERN_ERR, fnic->lport->host,
 				     "Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n",
-				     sc->request->tag, sc);
+				     tag, sc);
 
 		FNIC_TRACE(fnic_cleanup_io,
-			   sc->device->host->host_no, sc->request->tag, sc,
+			   sc->device->host->host_no, tag, sc,
 			   jiffies_to_msecs(jiffies - start_time),
 			   0, ((u64)sc->cmnd[0] << 32 |
 			       (u64)sc->cmnd[2] << 24 |
@@ -1566,7 +1566,7 @@ static bool fnic_rport_abort_io_iter(struct scsi_cmnd *sc, void *data,
 {
 	struct fnic_rport_abort_io_iter_data *iter_data = data;
 	struct fnic *fnic = iter_data->fnic;
-	int abt_tag = sc->request->tag;
+	int abt_tag = scsi_cmd_to_rq(sc)->tag;
 	struct fnic_io_req *io_req;
 	spinlock_t *io_lock;
 	unsigned long flags;
@@ -1727,6 +1727,7 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
  */
 int fnic_abort_cmd(struct scsi_cmnd *sc)
 {
+	struct request *const rq = scsi_cmd_to_rq(sc);
 	struct fc_lport *lp;
 	struct fnic *fnic;
 	struct fnic_io_req *io_req = NULL;
@@ -1741,7 +1742,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	struct abort_stats *abts_stats;
 	struct terminate_stats *term_stats;
 	enum fnic_ioreq_state old_ioreq_state;
-	int tag;
+	const int tag = rq->tag;
 	unsigned long abt_issued_time;
 	DECLARE_COMPLETION_ONSTACK(tm_done);
 
@@ -1757,7 +1758,6 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	term_stats = &fnic->fnic_stats.term_stats;
 
 	rport = starget_to_rport(scsi_target(sc->device));
-	tag = sc->request->tag;
 	FNIC_SCSI_DBG(KERN_DEBUG,
 		fnic->lport->host,
 		"Abort Cmd called FCID 0x%x, LUN 0x%llx TAG %x flags %x\n",
@@ -1842,8 +1842,8 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	/* Now queue the abort command to firmware */
 	int_to_scsilun(sc->device->lun, &fc_lun);
 
-	if (fnic_queue_abort_io_req(fnic, sc->request->tag, task_req,
-				    fc_lun.scsi_lun, io_req)) {
+	if (fnic_queue_abort_io_req(fnic, tag, task_req, fc_lun.scsi_lun,
+				    io_req)) {
 		spin_lock_irqsave(io_lock, flags);
 		if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING)
 			CMD_STATE(sc) = old_ioreq_state;
@@ -1943,8 +1943,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	}
 
 fnic_abort_cmd_end:
-	FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no,
-		  sc->request->tag, sc,
+	FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, tag, sc,
 		  jiffies_to_msecs(jiffies - start_time),
 		  0, ((u64)sc->cmnd[0] << 32 |
 		  (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 |
@@ -1994,7 +1993,7 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic,
 	/* fill in the lun info */
 	int_to_scsilun(sc->device->lun, &fc_lun);
 
-	fnic_queue_wq_copy_desc_itmf(wq, sc->request->tag | FNIC_TAG_DEV_RST,
+	fnic_queue_wq_copy_desc_itmf(wq, scsi_cmd_to_rq(sc)->tag | FNIC_TAG_DEV_RST,
 				     0, FCPIO_ITMF_LUN_RESET, SCSI_NO_TAG,
 				     fc_lun.scsi_lun, io_req->port_id,
 				     fnic->config.ra_tov, fnic->config.ed_tov);
@@ -2025,7 +2024,7 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,
 	struct fnic_pending_aborts_iter_data *iter_data = data;
 	struct fnic *fnic = iter_data->fnic;
 	struct scsi_device *lun_dev = iter_data->lun_dev;
-	int abt_tag = sc->request->tag;
+	int abt_tag = scsi_cmd_to_rq(sc)->tag;
 	struct fnic_io_req *io_req;
 	spinlock_t *io_lock;
 	unsigned long flags;
@@ -2206,14 +2205,15 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
 static inline int
 fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc)
 {
-	struct request_queue *q = sc->request->q;
+	struct request *rq = scsi_cmd_to_rq(sc);
+	struct request_queue *q = rq->q;
 	struct request *dummy;
 
 	dummy = blk_mq_alloc_request(q, REQ_OP_WRITE, BLK_MQ_REQ_NOWAIT);
 	if (IS_ERR(dummy))
 		return SCSI_NO_TAG;
 
-	sc->tag = sc->request->tag = dummy->tag;
+	sc->tag = rq->tag = dummy->tag;
 	sc->host_scribble = (unsigned char *)dummy;
 
 	return dummy->tag;
@@ -2238,6 +2238,7 @@ fnic_scsi_host_end_tag(struct fnic *fnic, struct scsi_cmnd *sc)
  */
 int fnic_device_reset(struct scsi_cmnd *sc)
 {
+	struct request *rq = scsi_cmd_to_rq(sc);
 	struct fc_lport *lp;
 	struct fnic *fnic;
 	struct fnic_io_req *io_req = NULL;
@@ -2250,7 +2251,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)
 	struct scsi_lun fc_lun;
 	struct fnic_stats *fnic_stats;
 	struct reset_stats *reset_stats;
-	int tag = 0;
+	int tag = rq->tag;
 	DECLARE_COMPLETION_ONSTACK(tm_done);
 	int tag_gen_flag = 0;   /*to track tags allocated by fnic driver*/
 	bool new_sc = 0;
@@ -2284,7 +2285,6 @@ int fnic_device_reset(struct scsi_cmnd *sc)
 	CMD_FLAGS(sc) = FNIC_DEVICE_RESET;
 	/* Allocate tag if not present */
 
-	tag = sc->request->tag;
 	if (unlikely(tag < 0)) {
 		/*
 		 * Really should fix the midlayer to pass in a proper
@@ -2458,8 +2458,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)
 	}
 
 fnic_device_reset_end:
-	FNIC_TRACE(fnic_device_reset, sc->device->host->host_no,
-		  sc->request->tag, sc,
+	FNIC_TRACE(fnic_device_reset, sc->device->host->host_no, rq->tag, sc,
 		  jiffies_to_msecs(jiffies - start_time),
 		  0, ((u64)sc->cmnd[0] << 32 |
 		  (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 |

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 21/52] hisi_sas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (19 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 20/52] fnic: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 22/52] hpsa: " Bart Van Assche
                   ` (32 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, John Garry, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 4 ++--
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 3a903e8e0384..9515c45affa5 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -185,7 +185,7 @@ static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
 	void *bitmap = hisi_hba->slot_index_tags;
 
 	if (scsi_cmnd)
-		return scsi_cmnd->request->tag;
+		return scsi_cmd_to_rq(scsi_cmnd)->tag;
 
 	spin_lock(&hisi_hba->lock);
 	index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
@@ -449,7 +449,7 @@ static int hisi_sas_task_prep(struct sas_task *task,
 		unsigned int dq_index;
 		u32 blk_tag;
 
-		blk_tag = blk_mq_unique_tag(scmd->request);
+		blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
 		dq_index = blk_mq_unique_tag_to_hwq(blk_tag);
 		*dq_pointer = dq = &hisi_hba->dq[dq_index];
 	} else {
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index a4885d03afe2..3ab669dc806f 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -1153,7 +1153,7 @@ static void fill_prot_v3_hw(struct scsi_cmnd *scsi_cmnd,
 {
 	unsigned char prot_op = scsi_get_prot_op(scsi_cmnd);
 	unsigned int interval = scsi_prot_interval(scsi_cmnd);
-	u32 lbrt_chk_val = t10_pi_ref_tag(scsi_cmnd->request);
+	u32 lbrt_chk_val = t10_pi_ref_tag(scsi_cmd_to_rq(scsi_cmnd));
 
 	switch (prot_op) {
 	case SCSI_PROT_READ_INSERT:

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 22/52] hpsa: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (20 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 21/52] hisi_sas: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 23/52] ibmvfc: " Bart Van Assche
                   ` (31 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Don Brace, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/hpsa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index f135a10f582b..3faa87fa296a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5686,7 +5686,7 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 	/* Get the ptr to our adapter structure out of cmd->host. */
 	h = sdev_to_hba(cmd->device);
 
-	BUG_ON(cmd->request->tag < 0);
+	BUG_ON(scsi_cmd_to_rq(cmd)->tag < 0);
 
 	dev = cmd->device->hostdata;
 	if (!dev) {
@@ -5729,7 +5729,7 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 	 *       and is therefore a brand-new command.
 	 */
 	if (likely(cmd->retries == 0 &&
-			!blk_rq_is_passthrough(cmd->request) &&
+			!blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)) &&
 			h->acciopath_status)) {
 		/* Submit with the retry_pending flag unset. */
 		rc = hpsa_ioaccel_submit(h, c, cmd, false);
@@ -5894,7 +5894,7 @@ static int hpsa_scsi_add_host(struct ctlr_info *h)
  */
 static int hpsa_get_cmd_index(struct scsi_cmnd *scmd)
 {
-	int idx = scmd->request->tag;
+	int idx = scsi_cmd_to_rq(scmd)->tag;
 
 	if (idx < 0)
 		return idx;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 23/52] ibmvfc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (21 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 22/52] hpsa: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 24/52] ibmvscsi: " Bart Van Assche
                   ` (30 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Tyrel Datwyler, Michael Ellerman,
	James E.J. Bottomley

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/ibmvscsi/ibmvfc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index bee1bec49c09..c372bbc5e218 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1911,7 +1911,7 @@ static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
 	struct ibmvfc_cmd *vfc_cmd;
 	struct ibmvfc_fcp_cmd_iu *iu;
 	struct ibmvfc_event *evt;
-	u32 tag_and_hwq = blk_mq_unique_tag(cmnd->request);
+	u32 tag_and_hwq = blk_mq_unique_tag(scsi_cmd_to_rq(cmnd));
 	u16 hwq = blk_mq_unique_tag_to_hwq(tag_and_hwq);
 	u16 scsi_channel;
 	int rc;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 24/52] ibmvscsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (22 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 23/52] ibmvfc: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 25/52] ips: " Bart Van Assche
                   ` (29 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Tyrel Datwyler, Michael Ellerman,
	James E.J. Bottomley

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/ibmvscsi/ibmvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index e6a3eaaa57d9..50df7dd9cb91 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1072,7 +1072,7 @@ static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd,
 	init_event_struct(evt_struct,
 			  handle_cmd_rsp,
 			  VIOSRP_SRP_FORMAT,
-			  cmnd->request->timeout/HZ);
+			  scsi_cmd_to_rq(cmnd)->timeout / HZ);
 
 	evt_struct->cmnd = cmnd;
 	evt_struct->cmnd_done = done;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 25/52] ips: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (23 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 24/52] ibmvscsi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 26/52] libsas: " Bart Van Assche
                   ` (28 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
	James E.J. Bottomley

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/ips.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 8b33c9871484..cdd94fb2aab7 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -3735,7 +3735,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 		scb->cmd.dcdb.segment_4G = 0;
 		scb->cmd.dcdb.enhanced_sg = 0;
 
-		TimeOut = scb->scsi_cmd->request->timeout;
+		TimeOut = scsi_cmd_to_rq(scb->scsi_cmd)->timeout;
 
 		if (ha->subsys->param[4] & 0x00100000) {	/* If NEW Tape DCDB is Supported */
 			if (!scb->sg_len) {

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 26/52] libsas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (24 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 25/52] ips: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 27/52] lpfc: " Bart Van Assche
                   ` (27 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, John Garry, James E.J. Bottomley,
	Jason Yan, Luo Jiaxing, Liu Shixin, Gustavo A. R. Silva,
	Jolly Shah, Yufen Yu

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/libsas/sas_ata.c       | 2 +-
 drivers/scsi/libsas/sas_scsi_host.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 1e0df6b17227..a315715b3622 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -596,7 +596,7 @@ void sas_ata_task_abort(struct sas_task *task)
 
 	/* Bounce SCSI-initiated commands to the SCSI EH */
 	if (qc->scsicmd) {
-		blk_abort_request(qc->scsicmd->request);
+		blk_abort_request(scsi_cmd_to_rq(qc->scsicmd));
 		return;
 	}
 
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 5db10248f187..08ffb8788290 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -908,7 +908,7 @@ void sas_task_abort(struct sas_task *task)
 	if (dev_is_sata(task->dev))
 		sas_ata_task_abort(task);
 	else
-		blk_abort_request(sc->request);
+		blk_abort_request(scsi_cmd_to_rq(sc));
 }
 
 int sas_slave_alloc(struct scsi_device *sdev)

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 27/52] lpfc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (25 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 26/52] libsas: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 28/52] megaraid: " Bart Van Assche
                   ` (26 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, James Smart, Dick Kennedy,
	James E.J. Bottomley

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/lpfc/lpfc_scsi.c | 71 ++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 38 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index ee4ff4855866..f905a53d050f 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -683,7 +683,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
 
 	cpu = raw_smp_processor_id();
 	if (cmnd && phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_HDWQ) {
-		tag = blk_mq_unique_tag(cmnd->request);
+		tag = blk_mq_unique_tag(scsi_cmd_to_rq(cmnd));
 		idx = blk_mq_unique_tag_to_hwq(tag);
 	} else {
 		idx = phba->sli4_hba.cpu_map[cpu].hdwq;
@@ -1046,7 +1046,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 		return 0;
 
 	sgpe = scsi_prot_sglist(sc);
-	lba = t10_pi_ref_tag(sc->request);
+	lba = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
 	if (lba == LPFC_INVALID_REFTAG)
 		return 0;
 
@@ -1629,7 +1629,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 		goto out;
 
 	/* extract some info from the scsi command for pde*/
-	reftag = t10_pi_ref_tag(sc->request);
+	reftag = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
 	if (reftag == LPFC_INVALID_REFTAG)
 		goto out;
 
@@ -1792,7 +1792,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
 	/* extract some info from the scsi command */
 	blksize = lpfc_cmd_blksize(sc);
-	reftag = t10_pi_ref_tag(sc->request);
+	reftag = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
 	if (reftag == LPFC_INVALID_REFTAG)
 		goto out;
 
@@ -2023,7 +2023,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 		goto out;
 
 	/* extract some info from the scsi command for pde*/
-	reftag = t10_pi_ref_tag(sc->request);
+	reftag = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
 	if (reftag == LPFC_INVALID_REFTAG)
 		goto out;
 
@@ -2224,7 +2224,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
 	/* extract some info from the scsi command */
 	blksize = lpfc_cmd_blksize(sc);
-	reftag = t10_pi_ref_tag(sc->request);
+	reftag = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
 	if (reftag == LPFC_INVALID_REFTAG)
 		goto out;
 
@@ -2818,7 +2818,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 			chk_guard = 1;
 
 		src = (struct scsi_dif_tuple *)sg_virt(sgpe);
-		start_ref_tag = t10_pi_ref_tag(cmd->request);
+		start_ref_tag = t10_pi_ref_tag(scsi_cmd_to_rq(cmd));
 		if (start_ref_tag == LPFC_INVALID_REFTAG)
 			goto out;
 		start_app_tag = src->app_tag;
@@ -2910,7 +2910,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 		phba->bg_guard_err_cnt++;
 		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
 				"9069 BLKGRD: reftag %x grd_tag err %x != %x\n",
-				t10_pi_ref_tag(cmd->request),
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
 				sum, guard_tag);
 
 	} else if (err_type == BGS_REFTAG_ERR_MASK) {
@@ -2920,7 +2920,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 		phba->bg_reftag_err_cnt++;
 		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
 				"9066 BLKGRD: reftag %x ref_tag err %x != %x\n",
-				t10_pi_ref_tag(cmd->request),
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
 				ref_tag, start_ref_tag);
 
 	} else if (err_type == BGS_APPTAG_ERR_MASK) {
@@ -2930,7 +2930,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 		phba->bg_apptag_err_cnt++;
 		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
 				"9041 BLKGRD: reftag %x app_tag err %x != %x\n",
-				t10_pi_ref_tag(cmd->request),
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
 				app_tag, start_app_tag);
 	}
 }
@@ -2992,7 +2992,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
 				(unsigned long long)scsi_get_lba(cmd),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 	}
 
 	if (lpfc_bgs_get_reftag_err(bgstat)) {
@@ -3007,7 +3007,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
 				(unsigned long long)scsi_get_lba(cmd),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 	}
 
 	if (lpfc_bgs_get_apptag_err(bgstat)) {
@@ -3022,7 +3022,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
 				(unsigned long long)scsi_get_lba(cmd),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 	}
 
 	if (lpfc_bgs_get_hi_water_mark_present(bgstat)) {
@@ -3066,7 +3066,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
 				(unsigned long long)scsi_get_lba(cmd),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 
 		/* Calcuate what type of error it was */
 		lpfc_calc_bg_err(phba, lpfc_cmd);
@@ -3103,8 +3103,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9072 BLKGRD: Invalid BG Profile in cmd "
 				"0x%x reftag 0x%x blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				t10_pi_ref_tag(cmd->request),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 		ret = (-1);
 		goto out;
 	}
@@ -3115,8 +3115,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9073 BLKGRD: Invalid BG PDIF Block in cmd "
 				"0x%x reftag 0x%x blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				t10_pi_ref_tag(cmd->request),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 		ret = (-1);
 		goto out;
 	}
@@ -3131,8 +3131,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9055 BLKGRD: Guard Tag error in cmd "
 				"0x%x reftag 0x%x blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				t10_pi_ref_tag(cmd->request),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 	}
 
 	if (lpfc_bgs_get_reftag_err(bgstat)) {
@@ -3146,8 +3146,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9056 BLKGRD: Ref Tag error in cmd "
 				"0x%x reftag 0x%x blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				t10_pi_ref_tag(cmd->request),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 	}
 
 	if (lpfc_bgs_get_apptag_err(bgstat)) {
@@ -3161,8 +3161,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9061 BLKGRD: App Tag error in cmd "
 				"0x%x reftag 0x%x blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				t10_pi_ref_tag(cmd->request),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 	}
 
 	if (lpfc_bgs_get_hi_water_mark_present(bgstat)) {
@@ -3205,8 +3205,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9057 BLKGRD: Unknown error in cmd "
 				"0x%x reftag 0x%x blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				t10_pi_ref_tag(cmd->request),
-				blk_rq_sectors(cmd->request), bgstat, bghm);
+				t10_pi_ref_tag(scsi_cmd_to_rq(cmd)),
+				blk_rq_sectors(scsi_cmd_to_rq(cmd)), bgstat, bghm);
 
 		/* Calcuate what type of error it was */
 		lpfc_calc_bg_err(phba, lpfc_cmd);
@@ -5419,13 +5419,9 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct
  */
 static char *lpfc_is_command_vm_io(struct scsi_cmnd *cmd)
 {
-	char *uuid = NULL;
+	struct bio *bio = scsi_cmd_to_rq(cmd)->bio;
 
-	if (cmd->request) {
-		if (cmd->request->bio)
-			uuid = blkcg_get_fc_appid(cmd->request->bio);
-	}
-	return uuid;
+	return bio ? blkcg_get_fc_appid(bio) : NULL;
 }
 
 /**
@@ -5553,8 +5549,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
 					 "reftag x%x cnt %u pt %x\n",
 					 dif_op_str[scsi_get_prot_op(cmnd)],
 					 cmnd->cmnd[0],
-					 t10_pi_ref_tag(cmnd->request),
-					 blk_rq_sectors(cmnd->request),
+					 t10_pi_ref_tag(scsi_cmd_to_rq(cmnd)),
+					 blk_rq_sectors(scsi_cmd_to_rq(cmnd)),
 					 (cmnd->cmnd[1]>>5));
 		}
 		err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd);
@@ -5565,8 +5561,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
 					 "9038 BLKGRD: rcvd PROT_NORMAL cmd: "
 					 "x%x reftag x%x cnt %u pt %x\n",
 					 cmnd->cmnd[0],
-					 t10_pi_ref_tag(cmnd->request),
-					 blk_rq_sectors(cmnd->request),
+					 t10_pi_ref_tag(scsi_cmd_to_rq(cmnd)),
+					 blk_rq_sectors(scsi_cmd_to_rq(cmnd)),
 					 (cmnd->cmnd[1]>>5));
 		}
 		err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd);
@@ -5637,8 +5633,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
 				   bf_get(wqe_tmo,
 				   &lpfc_cmd->cur_iocbq.wqe.generic.wqe_com) :
 				   lpfc_cmd->cur_iocbq.iocb.ulpTimeout,
-				   (uint32_t)
-				   (cmnd->request->timeout / 1000));
+				   (uint32_t)(scsi_cmd_to_rq(cmnd)->timeout / 1000));
 
 		goto out_host_busy_free_buf;
 	}

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 28/52] megaraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (26 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 27/52] lpfc: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 29/52] mpi3mr: " Bart Van Assche
                   ` (25 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Kashyap Desai, Sumit Saxena,
	Shivasharan S, James E.J. Bottomley

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/megaraid/megaraid_sas_base.c   |  4 ++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index ec10b2497310..e4298bf4a482 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1451,10 +1451,10 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
 	 * pthru timeout to the os layer timeout value.
 	 */
 	if (scp->device->type == TYPE_TAPE) {
-		if ((scp->request->timeout / HZ) > 0xFFFF)
+		if (scsi_cmd_to_rq(scp)->timeout / HZ > 0xFFFF)
 			pthru->timeout = cpu_to_le16(0xFFFF);
 		else
-			pthru->timeout = cpu_to_le16(scp->request->timeout / HZ);
+			pthru->timeout = cpu_to_le16(scsi_cmd_to_rq(scp)->timeout / HZ);
 	}
 
 	/*
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 06399c026a8d..26d0cf9353dd 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -402,7 +402,7 @@ megasas_get_msix_index(struct megasas_instance *instance,
 			(mega_mod64(atomic64_add_return(1, &instance->total_io_count),
 				instance->msix_vectors));
 	} else if (instance->host->nr_hw_queues > 1) {
-		u32 tag = blk_mq_unique_tag(scmd->request);
+		u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
 
 		cmd->request_desc->SCSIIO.MSIxIndex = blk_mq_unique_tag_to_hwq(tag) +
 			instance->low_latency_index_start;
@@ -3023,7 +3023,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
 		io_request->DevHandle = cpu_to_le16(device_id);
 		io_request->LUN[1] = scmd->device->lun;
 		pRAID_Context->timeout_value =
-			cpu_to_le16 (scmd->request->timeout / HZ);
+			cpu_to_le16(scsi_cmd_to_rq(scmd)->timeout / HZ);
 		cmd->request_desc->SCSIIO.RequestFlags =
 			(MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO <<
 			MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
@@ -3086,7 +3086,7 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
 
 	device_id = MEGASAS_DEV_INDEX(scmd);
 	pd_index = MEGASAS_PD_INDEX(scmd);
-	os_timeout_value = scmd->request->timeout / HZ;
+	os_timeout_value = scsi_cmd_to_rq(scmd)->timeout / HZ;
 	mr_device_priv_data = scmd->device->hostdata;
 	cmd->pd_interface = mr_device_priv_data->interface_type;
 
@@ -3381,7 +3381,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 		return SCSI_MLQUEUE_HOST_BUSY;
 	}
 
-	cmd = megasas_get_cmd_fusion(instance, scmd->request->tag);
+	cmd = megasas_get_cmd_fusion(instance, scsi_cmd_to_rq(scmd)->tag);
 
 	if (!cmd) {
 		atomic_dec(&instance->fw_outstanding);
@@ -3422,7 +3422,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 	 */
 	if (cmd->r1_alt_dev_handle != MR_DEVHANDLE_INVALID) {
 		r1_cmd = megasas_get_cmd_fusion(instance,
-				(scmd->request->tag + instance->max_fw_cmds));
+				scsi_cmd_to_rq(scmd)->tag + instance->max_fw_cmds);
 		megasas_prepare_secondRaid1_IO(instance, cmd, r1_cmd);
 	}
 

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 29/52] mpi3mr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (27 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 28/52] megaraid: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-16  8:32   ` Kashyap Desai
  2021-08-09 23:03 ` [PATCH v5 30/52] mpt3sas: " Bart Van Assche
                   ` (24 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Sathya Prakash Veerichetty,
	Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley

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/mpi3mr/mpi3mr_os.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 24ac7ddec749..bc1c32f599de 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -50,7 +50,7 @@ static u16 mpi3mr_host_tag_for_scmd(struct mpi3mr_ioc *mrioc,
 	u32 unique_tag;
 	u16 host_tag, hw_queue;
 
-	unique_tag = blk_mq_unique_tag(scmd->request);
+	unique_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
 
 	hw_queue = blk_mq_unique_tag_to_hwq(unique_tag);
 	if (hw_queue >= mrioc->num_op_reply_q)
@@ -2016,7 +2016,7 @@ static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc,
 	case SCSI_PROT_DIF_TYPE0:
 		eedp_flags |= MPI3_EEDPFLAGS_INCR_PRI_REF_TAG;
 		scsiio_req->cdb.eedp32.primary_reference_tag =
-		    cpu_to_be32(t10_pi_ref_tag(scmd->request));
+		    cpu_to_be32(t10_pi_ref_tag(scsi_cmd_to_rq(scmd)));
 		break;
 	case SCSI_PROT_DIF_TYPE1:
 	case SCSI_PROT_DIF_TYPE2:
@@ -2024,7 +2024,7 @@ static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc,
 		    MPI3_EEDPFLAGS_ESC_MODE_APPTAG_DISABLE |
 		    MPI3_EEDPFLAGS_CHK_GUARD;
 		scsiio_req->cdb.eedp32.primary_reference_tag =
-		    cpu_to_be32(t10_pi_ref_tag(scmd->request));
+		    cpu_to_be32(t10_pi_ref_tag(scsi_cmd_to_rq(scmd)));
 		break;
 	case SCSI_PROT_DIF_TYPE3:
 		eedp_flags |= MPI3_EEDPFLAGS_CHK_GUARD |
@@ -3451,7 +3451,7 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
 	u16 dev_handle;
 	u16 host_tag;
 	u32 scsiio_flags = 0;
-	struct request *rq = scmd->request;
+	struct request *rq = scsi_cmd_to_rq(scmd);
 	int iprio_class;
 
 	sdev_priv_data = scmd->device->hostdata;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 30/52] mpt3sas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (28 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 29/52] mpi3mr: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 31/52] mvumi: " Bart Van Assche
                   ` (23 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Sathya Prakash, Sreekanth Reddy,
	Suganath Prabu Subramani, James E.J. Bottomley

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/mpt3sas/mpt3sas_base.c  | 4 ++--
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index c39955239d1c..b9c513ef7134 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3651,7 +3651,7 @@ _base_get_msix_index(struct MPT3SAS_ADAPTER *ioc,
 		    &ioc->total_io_cnt), ioc->reply_queue_count) : 0;
 
 	if (scmd && ioc->shost->nr_hw_queues > 1) {
-		u32 tag = blk_mq_unique_tag(scmd->request);
+		u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
 
 		return blk_mq_unique_tag_to_hwq(tag) +
 			ioc->high_iops_queues;
@@ -3735,7 +3735,7 @@ mpt3sas_base_get_smid_scsiio(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx,
 	u16 smid;
 	u32 tag, unique_tag;
 
-	unique_tag = blk_mq_unique_tag(scmd->request);
+	unique_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
 	tag = blk_mq_unique_tag_to_tag(unique_tag);
 
 	/*
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 866d118f7931..0e8f6d9a998a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3304,7 +3304,7 @@ scsih_abort(struct scsi_cmnd *scmd)
 	sdev_printk(KERN_INFO, scmd->device, "attempting task abort!"
 	    "scmd(0x%p), outstanding for %u ms & timeout %u ms\n",
 	    scmd, jiffies_to_msecs(jiffies - scmd->jiffies_at_alloc),
-	    (scmd->request->timeout / HZ) * 1000);
+	    (scsi_cmd_to_rq(scmd)->timeout / HZ) * 1000);
 	_scsih_tm_display_info(ioc, scmd);
 
 	sas_device_priv_data = scmd->device->hostdata;
@@ -5074,7 +5074,7 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
 		    MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
 		    MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
 		mpi_request->CDB.EEDP32.PrimaryReferenceTag =
-		    cpu_to_be32(t10_pi_ref_tag(scmd->request));
+		    cpu_to_be32(t10_pi_ref_tag(scsi_cmd_to_rq(scmd)));
 		break;
 
 	case SCSI_PROT_DIF_TYPE3:
@@ -5141,7 +5141,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	struct MPT3SAS_DEVICE *sas_device_priv_data;
 	struct MPT3SAS_TARGET *sas_target_priv_data;
 	struct _raid_device *raid_device;
-	struct request *rq = scmd->request;
+	struct request *rq = scsi_cmd_to_rq(scmd);
 	int class;
 	Mpi25SCSIIORequest_t *mpi_request;
 	struct _pcie_device *pcie_device = NULL;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 31/52] mvumi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (29 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 30/52] mpt3sas: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 32/52] myrb: " Bart Van Assche
                   ` (22 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

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/mvumi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 6bb03d7a254d..4d251bf630a3 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -702,7 +702,7 @@ static int mvumi_host_reset(struct scsi_cmnd *scmd)
 	mhba = (struct mvumi_hba *) scmd->device->host->hostdata;
 
 	scmd_printk(KERN_NOTICE, scmd, "RESET -%u cmd=%x retries=%x\n",
-			scmd->request->tag, scmd->cmnd[0], scmd->retries);
+			scsi_cmd_to_rq(scmd)->tag, scmd->cmnd[0], scmd->retries);
 
 	return mhba->instancet->reset_host(mhba);
 }

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 32/52] myrb: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (30 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 31/52] mvumi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 33/52] myrs: " Bart Van Assche
                   ` (21 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, James E.J. Bottomley

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/myrb.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index 542ed88ef90d..a4a88323e020 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -1263,6 +1263,7 @@ static int myrb_host_reset(struct scsi_cmnd *scmd)
 static int myrb_pthru_queuecommand(struct Scsi_Host *shost,
 		struct scsi_cmnd *scmd)
 {
+	struct request *rq = scsi_cmd_to_rq(scmd);
 	struct myrb_hba *cb = shost_priv(shost);
 	struct myrb_cmdblk *cmd_blk = scsi_cmd_priv(scmd);
 	union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
@@ -1286,7 +1287,7 @@ static int myrb_pthru_queuecommand(struct Scsi_Host *shost,
 	}
 
 	mbox->type3.opcode = MYRB_CMD_DCDB;
-	mbox->type3.id = scmd->request->tag + 3;
+	mbox->type3.id = rq->tag + 3;
 	mbox->type3.addr = dcdb_addr;
 	dcdb->channel = sdev->channel;
 	dcdb->target = sdev->id;
@@ -1305,11 +1306,11 @@ static int myrb_pthru_queuecommand(struct Scsi_Host *shost,
 		break;
 	}
 	dcdb->early_status = false;
-	if (scmd->request->timeout <= 10)
+	if (rq->timeout <= 10)
 		dcdb->timeout = MYRB_DCDB_TMO_10_SECS;
-	else if (scmd->request->timeout <= 60)
+	else if (rq->timeout <= 60)
 		dcdb->timeout = MYRB_DCDB_TMO_60_SECS;
-	else if (scmd->request->timeout <= 600)
+	else if (rq->timeout <= 600)
 		dcdb->timeout = MYRB_DCDB_TMO_10_MINS;
 	else
 		dcdb->timeout = MYRB_DCDB_TMO_24_HRS;
@@ -1550,7 +1551,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
 	}
 
 	myrb_reset_cmd(cmd_blk);
-	mbox->type5.id = scmd->request->tag + 3;
+	mbox->type5.id = scsi_cmd_to_rq(scmd)->tag + 3;
 	if (scmd->sc_data_direction == DMA_NONE)
 		goto submit;
 	nsge = scsi_dma_map(scmd);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 33/52] myrs: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (31 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 32/52] myrb: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 34/52] ncr53c8xx: " Bart Van Assche
                   ` (20 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, James E.J. Bottomley

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/myrs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 26326af23dbc..07f274afd7e5 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -1582,6 +1582,7 @@ static void myrs_mode_sense(struct myrs_hba *cs, struct scsi_cmnd *scmd,
 static int myrs_queuecommand(struct Scsi_Host *shost,
 		struct scsi_cmnd *scmd)
 {
+	struct request *rq = scsi_cmd_to_rq(scmd);
 	struct myrs_hba *cs = shost_priv(shost);
 	struct myrs_cmdblk *cmd_blk = scsi_cmd_priv(scmd);
 	union myrs_cmd_mbox *mbox = &cmd_blk->mbox;
@@ -1628,7 +1629,7 @@ static int myrs_queuecommand(struct Scsi_Host *shost,
 		return SCSI_MLQUEUE_HOST_BUSY;
 	cmd_blk->sense_addr = sense_addr;
 
-	timeout = scmd->request->timeout;
+	timeout = rq->timeout;
 	if (scmd->cmd_len <= 10) {
 		if (scmd->device->channel >= cs->ctlr_info->physchan_present) {
 			struct myrs_ldev_info *ldev_info = sdev->hostdata;
@@ -1644,10 +1645,10 @@ static int myrs_queuecommand(struct Scsi_Host *shost,
 			mbox->SCSI_10.pdev.target = sdev->id;
 			mbox->SCSI_10.pdev.channel = sdev->channel;
 		}
-		mbox->SCSI_10.id = scmd->request->tag + 3;
+		mbox->SCSI_10.id = rq->tag + 3;
 		mbox->SCSI_10.control.dma_ctrl_to_host =
 			(scmd->sc_data_direction == DMA_FROM_DEVICE);
-		if (scmd->request->cmd_flags & REQ_FUA)
+		if (rq->cmd_flags & REQ_FUA)
 			mbox->SCSI_10.control.fua = true;
 		mbox->SCSI_10.dma_size = scsi_bufflen(scmd);
 		mbox->SCSI_10.sense_addr = cmd_blk->sense_addr;
@@ -1690,10 +1691,10 @@ static int myrs_queuecommand(struct Scsi_Host *shost,
 			mbox->SCSI_255.pdev.target = sdev->id;
 			mbox->SCSI_255.pdev.channel = sdev->channel;
 		}
-		mbox->SCSI_255.id = scmd->request->tag + 3;
+		mbox->SCSI_255.id = rq->tag + 3;
 		mbox->SCSI_255.control.dma_ctrl_to_host =
 			(scmd->sc_data_direction == DMA_FROM_DEVICE);
-		if (scmd->request->cmd_flags & REQ_FUA)
+		if (rq->cmd_flags & REQ_FUA)
 			mbox->SCSI_255.control.fua = true;
 		mbox->SCSI_255.dma_size = scsi_bufflen(scmd);
 		mbox->SCSI_255.sense_addr = cmd_blk->sense_addr;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 34/52] ncr53c8xx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (32 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 33/52] myrs: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 35/52] qedf: " Bart Van Assche
                   ` (19 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

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/ncr53c8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index c76e9f05d042..09958f78b70f 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -4164,8 +4164,8 @@ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
 	**
 	**----------------------------------------------------
 	*/
-	if (np->settle_time && cmd->request->timeout >= HZ) {
-		u_long tlimit = jiffies + cmd->request->timeout - HZ;
+	if (np->settle_time && scsi_cmd_to_rq(cmd)->timeout >= HZ) {
+		u_long tlimit = jiffies + scsi_cmd_to_rq(cmd)->timeout - HZ;
 		if (time_after(np->settle_time, tlimit))
 			np->settle_time = tlimit;
 	}

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 35/52] qedf: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (33 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 34/52] ncr53c8xx: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 36/52] qedi: " Bart Van Assche
                   ` (18 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Saurav Kashyap, Javed Hasan,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley

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/qedf/qedf_io.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index 6b5b6a75ac88..3404782988d5 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -1162,13 +1162,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
 		return;
 	}
 
-	if (!sc_cmd->request) {
-		QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd->request is NULL, "
-		    "sc_cmd=%p.\n", sc_cmd);
-		return;
-	}
-
-	if (!sc_cmd->request->q) {
+	if (!scsi_cmd_to_rq(sc_cmd)->q) {
 		QEDF_WARN(&(qedf->dbg_ctx), "request->q is NULL so request "
 		   "is not valid, sc_cmd=%p.\n", sc_cmd);
 		return;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 36/52] qedi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (34 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 35/52] qedf: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 37/52] qla1280: " Bart Van Assche
                   ` (17 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Nilesh Javali, Manish Rangankar,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley

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/qedi/qedi_fw.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
index 71333d3c5c86..ac99e980bb31 100644
--- a/drivers/scsi/qedi/qedi_fw.c
+++ b/drivers/scsi/qedi/qedi_fw.c
@@ -609,14 +609,7 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi,
 		goto error;
 	}
 
-	if (!sc_cmd->request) {
-		QEDI_WARN(&qedi->dbg_ctx,
-			  "sc_cmd->request is NULL, sc_cmd=%p.\n",
-			  sc_cmd);
-		goto error;
-	}
-
-	if (!sc_cmd->request->q) {
+	if (!scsi_cmd_to_rq(sc_cmd)->q) {
 		QEDI_WARN(&qedi->dbg_ctx,
 			  "request->q is NULL so request is not valid, sc_cmd=%p.\n",
 			  sc_cmd);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 37/52] qla1280: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (35 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 36/52] qedi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 38/52] qla2xxx: " Bart Van Assche
                   ` (16 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Michael Reed, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. Remove the unused CMD_REQUEST() macro. This patch does not change
any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla1280.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 928da90b79be..9f9b4900c3ab 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -490,7 +490,6 @@ __setup("qla1280=", qla1280_setup);
 #define	CMD_SNSLEN(Cmnd)	SCSI_SENSE_BUFFERSIZE
 #define	CMD_RESULT(Cmnd)	Cmnd->result
 #define	CMD_HANDLE(Cmnd)	Cmnd->host_scribble
-#define CMD_REQUEST(Cmnd)	Cmnd->request->cmd
 
 #define CMD_HOST(Cmnd)		Cmnd->device->host
 #define SCSI_BUS_32(Cmnd)	Cmnd->device->channel
@@ -2827,7 +2826,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
 	memset(((char *)pkt + 8), 0, (REQUEST_ENTRY_SIZE - 8));
 
 	/* Set ISP command timeout. */
-	pkt->timeout = cpu_to_le16(cmd->request->timeout/HZ);
+	pkt->timeout = cpu_to_le16(scsi_cmd_to_rq(cmd)->timeout / HZ);
 
 	/* Set device target ID and LUN */
 	pkt->lun = SCSI_LUN_32(cmd);
@@ -3082,7 +3081,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
 	memset(((char *)pkt + 8), 0, (REQUEST_ENTRY_SIZE - 8));
 
 	/* Set ISP command timeout. */
-	pkt->timeout = cpu_to_le16(cmd->request->timeout/HZ);
+	pkt->timeout = cpu_to_le16(scsi_cmd_to_rq(cmd)->timeout / HZ);
 
 	/* Set device target ID and LUN */
 	pkt->lun = SCSI_LUN_32(cmd);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 38/52] qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (36 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 37/52] qla1280: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 39/52] qla4xxx: " Bart Van Assche
                   ` (15 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Nilesh Javali,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley

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/qla2xxx/qla_os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 868037c7d608..126ac7e24ea9 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -854,7 +854,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 		uint16_t hwq;
 		struct qla_qpair *qpair = NULL;
 
-		tag = blk_mq_unique_tag(cmd->request);
+		tag = blk_mq_unique_tag(scsi_cmd_to_rq(cmd));
 		hwq = blk_mq_unique_tag_to_hwq(tag);
 		qpair = ha->queue_pair_map[hwq];
 
@@ -1763,7 +1763,7 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res,
 		}
 
 		spin_lock_irqsave(qp->qp_lock_ptr, *flags);
-		if (ret_cmd && blk_mq_request_started(cmd->request))
+		if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd)))
 			sp->done(sp, res);
 	} else {
 		sp->done(sp, res);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 39/52] qla4xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (37 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 38/52] qla2xxx: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 40/52] qlogicpti: " Bart Van Assche
                   ` (14 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Nilesh Javali, Manish Rangankar,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley

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/qla4xxx/ql4_iocb.c | 2 +-
 drivers/scsi/qla4xxx/ql4_os.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index c57cec6fff6d..28eab07935ba 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -288,7 +288,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
 	/* Acquire hardware specific lock */
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 
-	index = (uint32_t)cmd->request->tag;
+	index = scsi_cmd_to_rq(cmd)->tag;
 
 	/*
 	 * Check to see if adapter is online before placing request on
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 3f7737386193..f1ea65c6e5f5 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -9282,7 +9282,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
 	DEBUG2(printk(KERN_INFO
 		      "scsi%ld: DEVICE_RESET cmd=%p jiffies = 0x%lx, to=%x,"
 		      "dpc_flags=%lx, status=%x allowed=%d\n", ha->host_no,
-		      cmd, jiffies, cmd->request->timeout / HZ,
+		      cmd, jiffies, scsi_cmd_to_rq(cmd)->timeout / HZ,
 		      ha->dpc_flags, cmd->result, cmd->allowed));
 
 	rval = qla4xxx_isp_check_reg(ha);
@@ -9349,7 +9349,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
 	DEBUG2(printk(KERN_INFO
 		      "scsi%ld: TARGET_DEVICE_RESET cmd=%p jiffies = 0x%lx, "
 		      "to=%x,dpc_flags=%lx, status=%x allowed=%d\n",
-		      ha->host_no, cmd, jiffies, cmd->request->timeout / HZ,
+		      ha->host_no, cmd, jiffies, scsi_cmd_to_rq(cmd)->timeout / HZ,
 		      ha->dpc_flags, cmd->result, cmd->allowed));
 
 	rval = qla4xxx_isp_check_reg(ha);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 40/52] qlogicpti: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (38 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 39/52] qla4xxx: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 41/52] scsi_debug: " Bart Van Assche
                   ` (13 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

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/qlogicpti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index d84e218d32cb..8e7e833a36cc 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -890,7 +890,7 @@ static inline void cmd_frob(struct Command_Entry *cmd, struct scsi_cmnd *Cmnd,
 		cmd->control_flags |= CFLAG_WRITE;
 	else
 		cmd->control_flags |= CFLAG_READ;
-	cmd->time_out = Cmnd->request->timeout/HZ;
+	cmd->time_out = scsi_cmd_to_rq(Cmnd)->timeout / HZ;
 	memcpy(cmd->cdb, Cmnd->cmnd, Cmnd->cmd_len);
 }
 

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 41/52] scsi_debug: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (39 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 40/52] qlogicpti: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 42/52] smartpqi: " Bart Van Assche
                   ` (12 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Douglas Gilbert, James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 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 25112b15ab14..31529d8add0d 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4722,7 +4722,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);
 
@@ -4735,7 +4735,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. */
@@ -5384,7 +5384,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;
@@ -5587,8 +5587,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;
 		}
@@ -7414,7 +7415,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;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 42/52] smartpqi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (40 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 41/52] scsi_debug: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 43/52] snic: " Bart Van Assche
                   ` (11 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Don Brace, James E.J. Bottomley

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/smartpqi/smartpqi_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index c1f0f8da9fe2..d95498ff136a 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -5568,7 +5568,7 @@ static inline u16 pqi_get_hw_queue(struct pqi_ctrl_info *ctrl_info,
 {
 	u16 hw_queue;
 
-	hw_queue = blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(scmd->request));
+	hw_queue = blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(scsi_cmd_to_rq(scmd)));
 	if (hw_queue > ctrl_info->max_hw_queue_index)
 		hw_queue = 0;
 
@@ -5577,7 +5577,7 @@ static inline u16 pqi_get_hw_queue(struct pqi_ctrl_info *ctrl_info,
 
 static inline bool pqi_is_bypass_eligible_request(struct scsi_cmnd *scmd)
 {
-	if (blk_rq_is_passthrough(scmd->request))
+	if (blk_rq_is_passthrough(scsi_cmd_to_rq(scmd)))
 		return false;
 
 	return scmd->SCp.this_residual == 0;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 43/52] snic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (41 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 42/52] smartpqi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 44/52] stex: " Bart Van Assche
                   ` (10 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Karan Tilak Kumar, Sesidhar Baddela,
	James E.J. Bottomley

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/snic/snic_scsi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 6dd0ff188bb4..d5a807c9c0d3 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -33,7 +33,7 @@
 #include "snic_io.h"
 #include "snic.h"
 
-#define snic_cmd_tag(sc)	(((struct scsi_cmnd *) sc)->request->tag)
+#define snic_cmd_tag(sc)	(scsi_cmd_to_rq(sc)->tag)
 
 const char *snic_state_str[] = {
 	[SNIC_INIT]	= "SNIC_INIT",
@@ -1636,7 +1636,7 @@ snic_abort_cmd(struct scsi_cmnd *sc)
 	u32 start_time = jiffies;
 
 	SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n",
-		       sc, sc->cmnd[0], sc->request, tag);
+		       sc, sc->cmnd[0], scsi_cmd_to_rq(sc), tag);
 
 	if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) {
 		SNIC_HOST_ERR(snic->shost,
@@ -2152,7 +2152,7 @@ snic_device_reset(struct scsi_cmnd *sc)
 	int dr_supp = 0;
 
 	SNIC_SCSI_DBG(shost, "dev_reset:sc %p :0x%x :req = %p :tag = %d\n",
-		      sc, sc->cmnd[0], sc->request,
+		      sc, sc->cmnd[0], scsi_cmd_to_rq(sc),
 		      snic_cmd_tag(sc));
 	dr_supp = snic_dev_reset_supported(sc->device);
 	if (!dr_supp) {
@@ -2387,7 +2387,7 @@ snic_host_reset(struct scsi_cmnd *sc)
 
 	SNIC_SCSI_DBG(shost,
 		      "host reset:sc %p sc_cmd 0x%x req %p tag %d flags 0x%llx\n",
-		      sc, sc->cmnd[0], sc->request,
+		      sc, sc->cmnd[0], scsi_cmd_to_rq(sc),
 		      snic_cmd_tag(sc), CMD_FLAGS(sc));
 
 	ret = snic_reset(shost, sc);
@@ -2494,7 +2494,7 @@ snic_scsi_cleanup(struct snic *snic, int ex_tag)
 		sc->result = DID_TRANSPORT_DISRUPTED << 16;
 		SNIC_HOST_INFO(snic->shost,
 			       "sc_clean: DID_TRANSPORT_DISRUPTED for sc %p, Tag %d flags 0x%llx rqi %p duration %u msecs\n",
-			       sc, sc->request->tag, CMD_FLAGS(sc), rqi,
+			       sc, scsi_cmd_to_rq(sc)->tag, CMD_FLAGS(sc), rqi,
 			       jiffies_to_msecs(jiffies - st_time));
 
 		/* Update IO stats */

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 44/52] stex: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (42 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 43/52] snic: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 45/52] sun3_scsi: " Bart Van Assche
                   ` (9 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

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/stex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 491b435273a6..f1ba7f5b52a8 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -540,7 +540,7 @@ stex_ss_send_cmd(struct st_hba *hba, struct req_msg *req, u16 tag)
 	msg_h = (struct st_msg_header *)req - 1;
 	if (likely(cmd)) {
 		msg_h->channel = (u8)cmd->device->channel;
-		msg_h->timeout = cpu_to_le16(cmd->request->timeout/HZ);
+		msg_h->timeout = cpu_to_le16(scsi_cmd_to_rq(cmd)->timeout / HZ);
 	}
 	addr = hba->dma_handle + hba->req_head * hba->rq_size;
 	addr += (hba->ccb[tag].sg_count+4)/11;
@@ -690,7 +690,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 
 	cmd->scsi_done = done;
 
-	tag = cmd->request->tag;
+	tag = scsi_cmd_to_rq(cmd)->tag;
 
 	if (unlikely(tag >= host->can_queue))
 		return SCSI_MLQUEUE_HOST_BUSY;
@@ -1246,7 +1246,7 @@ static int stex_abort(struct scsi_cmnd *cmd)
 {
 	struct Scsi_Host *host = cmd->device->host;
 	struct st_hba *hba = (struct st_hba *)host->hostdata;
-	u16 tag = cmd->request->tag;
+	u16 tag = scsi_cmd_to_rq(cmd)->tag;
 	void __iomem *base;
 	u32 data;
 	int result = SUCCESS;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 45/52] sun3_scsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (43 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 44/52] stex: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 46/52] sym53c8xx: " Bart Van Assche
                   ` (8 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Finn Thain, Michael Schmitz,
	James E.J. Bottomley

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/sun3_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index 9ed0bb7ecece..f7f724a3ff1d 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -336,7 +336,7 @@ static int sun3scsi_dma_xfer_len(struct NCR5380_hostdata *hostdata,
 {
 	int wanted_len = cmd->SCp.this_residual;
 
-	if (wanted_len < DMA_MIN_SIZE || blk_rq_is_passthrough(cmd->request))
+	if (wanted_len < DMA_MIN_SIZE || blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)))
 		return 0;
 
 	return wanted_len;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 46/52] sym53c8xx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (44 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 45/52] sun3_scsi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 47/52] ufs: " Bart Van Assche
                   ` (7 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Matthew Wilcox, James E.J. Bottomley

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/sym53c8xx_2/sym_glue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 16b65fc4405c..6d0b07b9cb31 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -500,8 +500,8 @@ static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd,
 	 *  Shorten our settle_time if needed for 
 	 *  this command not to time out.
 	 */
-	if (np->s.settle_time_valid && cmd->request->timeout) {
-		unsigned long tlimit = jiffies + cmd->request->timeout;
+	if (np->s.settle_time_valid && scsi_cmd_to_rq(cmd)->timeout) {
+		unsigned long tlimit = jiffies + scsi_cmd_to_rq(cmd)->timeout;
 		tlimit -= SYM_CONF_TIMER_INTERVAL*2;
 		if (time_after(np->s.settle_time, tlimit)) {
 			np->s.settle_time = tlimit;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 47/52] ufs: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (45 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 46/52] sym53c8xx: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 48/52] virtio_scsi: " Bart Van Assche
                   ` (6 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Daejun Park, James E.J. Bottomley,
	Can Guo, Bean Huo, Stanley Chu, Avri Altman, Jaegeuk Kim,
	Asutosh Das, Greg Kroah-Hartman

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufshcd.c | 11 ++++++-----
 drivers/scsi/ufs/ufshpb.c | 19 ++++++++++---------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 6c263e94144b..72348153adb0 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -365,6 +365,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
 	u32 intr, doorbell;
 	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	struct scsi_cmnd *cmd = lrbp->cmd;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	int transfer_len = -1;
 
 	if (!cmd)
@@ -390,7 +391,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
 		/*
 		 * The number of Bytes to be unmapped beginning with the lba.
 		 */
-		transfer_len = blk_rq_bytes(cmd->request);
+		transfer_len = blk_rq_bytes(rq);
 	}
 
 	intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
@@ -2054,7 +2055,7 @@ static void ufshcd_update_monitor(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
 	if (dir >= 0 && hba->monitor.nr_queued[dir] > 0) {
-		struct request *req = lrbp->cmd->request;
+		struct request *req = scsi_cmd_to_rq(lrbp->cmd);
 		struct ufs_hba_monitor *m = &hba->monitor;
 		ktime_t now, inc, lat;
 
@@ -2675,7 +2676,7 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
 static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 {
 	struct ufs_hba *hba = shost_priv(host);
-	int tag = cmd->request->tag;
+	int tag = scsi_cmd_to_rq(cmd)->tag;
 	struct ufshcd_lrb *lrbp;
 	int err = 0;
 
@@ -2734,7 +2735,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 	lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
 	lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba) ? true : false;
 
-	ufshcd_prepare_lrbp_crypto(cmd->request, lrbp);
+	ufshcd_prepare_lrbp_crypto(scsi_cmd_to_rq(cmd), lrbp);
 
 	lrbp->req_abort_skip = false;
 
@@ -6974,7 +6975,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
 {
 	struct Scsi_Host *host = cmd->device->host;
 	struct ufs_hba *hba = shost_priv(host);
-	unsigned int tag = cmd->request->tag;
+	unsigned int tag = scsi_cmd_to_rq(cmd)->tag;
 	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	unsigned long flags;
 	int err = FAILED;
diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index d0eb14be47a3..908130596610 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -70,13 +70,14 @@ static int ufshpb_is_valid_srgn(struct ufshpb_region *rgn,
 
 static bool ufshpb_is_read_cmd(struct scsi_cmnd *cmd)
 {
-	return req_op(cmd->request) == REQ_OP_READ;
+	return req_op(scsi_cmd_to_rq(cmd)) == REQ_OP_READ;
 }
 
 static bool ufshpb_is_write_or_discard(struct scsi_cmnd *cmd)
 {
-	return op_is_write(req_op(cmd->request)) ||
-	       op_is_discard(req_op(cmd->request));
+	enum req_opf op = req_op(scsi_cmd_to_rq(cmd));
+
+	return op_is_write(op) || op_is_discard(op);
 }
 
 static bool ufshpb_is_supported_chunk(struct ufshpb_lu *hpb, int transfer_len)
@@ -516,9 +517,9 @@ static int ufshpb_execute_pre_req(struct ufshpb_lu *hpb, struct scsi_cmnd *cmd,
 
 	pre_req->hpb = hpb;
 	pre_req->wb.lpn = sectors_to_logical(cmd->device,
-					     blk_rq_pos(cmd->request));
+					     blk_rq_pos(scsi_cmd_to_rq(cmd)));
 	pre_req->wb.len = sectors_to_logical(cmd->device,
-					     blk_rq_sectors(cmd->request));
+					     blk_rq_sectors(scsi_cmd_to_rq(cmd)));
 	if (ufshpb_pre_req_add_bio_page(hpb, q, pre_req))
 		return -ENOMEM;
 
@@ -596,6 +597,7 @@ int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
 	struct ufshpb_region *rgn;
 	struct ufshpb_subregion *srgn;
 	struct scsi_cmnd *cmd = lrbp->cmd;
+	struct request *rq = scsi_cmd_to_rq(cmd);
 	u32 lpn;
 	__be64 ppn;
 	unsigned long flags;
@@ -616,17 +618,16 @@ int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
 		return -ENODEV;
 	}
 
-	if (blk_rq_is_passthrough(cmd->request) ||
+	if (blk_rq_is_passthrough(rq) ||
 	    (!ufshpb_is_write_or_discard(cmd) &&
 	     !ufshpb_is_read_cmd(cmd)))
 		return 0;
 
-	transfer_len = sectors_to_logical(cmd->device,
-					  blk_rq_sectors(cmd->request));
+	transfer_len = sectors_to_logical(cmd->device, blk_rq_sectors(rq));
 	if (unlikely(!transfer_len))
 		return 0;
 
-	lpn = sectors_to_logical(cmd->device, blk_rq_pos(cmd->request));
+	lpn = sectors_to_logical(cmd->device, blk_rq_pos(rq));
 	ufshpb_get_pos_from_lpn(hpb, lpn, &rgn_idx, &srgn_idx, &srgn_offset);
 	rgn = hpb->rgn_tbl + rgn_idx;
 	srgn = rgn->srgn_tbl + srgn_idx;

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 48/52] virtio_scsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (46 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 47/52] ufs: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 49/52] xen-scsifront: " Bart Van Assche
                   ` (5 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Michael S . Tsirkin, Jason Wang,
	James E.J. Bottomley

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/virtio_scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index b0deaf4af5a3..c25ce8f0e0af 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -519,7 +519,7 @@ static void virtio_scsi_init_hdr_pi(struct virtio_device *vdev,
 				    struct virtio_scsi_cmd_req_pi *cmd_pi,
 				    struct scsi_cmnd *sc)
 {
-	struct request *rq = sc->request;
+	struct request *rq = scsi_cmd_to_rq(sc);
 	struct blk_integrity *bi;
 
 	virtio_scsi_init_hdr(vdev, (struct virtio_scsi_cmd_req *)cmd_pi, sc);
@@ -543,7 +543,7 @@ static void virtio_scsi_init_hdr_pi(struct virtio_device *vdev,
 static struct virtio_scsi_vq *virtscsi_pick_vq_mq(struct virtio_scsi *vscsi,
 						  struct scsi_cmnd *sc)
 {
-	u32 tag = blk_mq_unique_tag(sc->request);
+	u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(sc));
 	u16 hwq = blk_mq_unique_tag_to_hwq(tag);
 
 	return &vscsi->req_vqs[hwq];

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 49/52] xen-scsifront: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (47 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 48/52] virtio_scsi: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-17 12:42   ` Juergen Gross
  2021-08-09 23:03 ` [PATCH v5 50/52] tcm_loop: " Bart Van Assche
                   ` (4 subsequent siblings)
  53 siblings, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Juergen Gross, Boris Ostrovsky,
	James E.J. Bottomley

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/xen-scsifront.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index ec9d399fbbd8..0204e314b482 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -212,7 +212,7 @@ static int scsifront_do_request(struct vscsifrnt_info *info,
 	memcpy(ring_req->cmnd, sc->cmnd, sc->cmd_len);
 
 	ring_req->sc_data_direction   = (uint8_t)sc->sc_data_direction;
-	ring_req->timeout_per_command = sc->request->timeout / HZ;
+	ring_req->timeout_per_command = scsi_cmd_to_rq(sc)->timeout / HZ;
 
 	for (i = 0; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT); i++)
 		ring_req->seg[i] = shadow->seg[i];

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 50/52] tcm_loop: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (48 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 49/52] xen-scsifront: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 51/52] usb-storage: " Bart Van Assche
                   ` (3 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Mike Christie, Himanshu Madhani,
	Colin Ian King, Hannes Reinecke

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/target/loopback/tcm_loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index fdc36274cb39..3dfc7ed79ba4 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -183,7 +183,7 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
 
 	memset(tl_cmd, 0, sizeof(*tl_cmd));
 	tl_cmd->sc = sc;
-	tl_cmd->sc_cmd_tag = sc->request->tag;
+	tl_cmd->sc_cmd_tag = scsi_cmd_to_rq(sc)->tag;
 
 	tcm_loop_target_queue_cmd(tl_cmd);
 	return 0;
@@ -249,7 +249,7 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc)
 	tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
 	tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
 	ret = tcm_loop_issue_tmr(tl_tpg, sc->device->lun,
-				 sc->request->tag, TMR_ABORT_TASK);
+				 scsi_cmd_to_rq(sc)->tag, TMR_ABORT_TASK);
 	return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED;
 }
 

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 51/52] usb-storage: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (49 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 50/52] tcm_loop: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-09 23:03 ` [PATCH v5 52/52] core: Remove the request member from struct scsi_cmnd Bart Van Assche
                   ` (2 subsequent siblings)
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Alan Stern, Greg Kroah-Hartman

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/usb/storage/transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index f4304ce69350..4c5a0a49035f 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -551,7 +551,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
 	/* Did this command access the last sector? */
 	sector = (srb->cmnd[2] << 24) | (srb->cmnd[3] << 16) |
 			(srb->cmnd[4] << 8) | (srb->cmnd[5]);
-	disk = srb->request->rq_disk;
+	disk = scsi_cmd_to_rq(srb)->rq_disk;
 	if (!disk)
 		goto done;
 	sdkp = scsi_disk(disk);

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 52/52] core: Remove the request member from struct scsi_cmnd
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (50 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 51/52] usb-storage: " Bart Van Assche
@ 2021-08-09 23:03 ` Bart Van Assche
  2021-08-10  5:28 ` [PATCH v5 00/52] Remove the request pointer " Martin K. Petersen
  2021-08-17  3:17 ` Martin K. Petersen
  53 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-09 23:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, James E.J. Bottomley

Since all scsi_cmnd.request users are gone, remove the request pointer
from struct scsi_cmnd.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_error.c | 1 -
 drivers/scsi/scsi_lib.c   | 1 -
 include/scsi/scsi_cmnd.h  | 3 ---
 3 files changed, 5 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index d85d308a0683..b6c86cce57bf 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2377,7 +2377,6 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
 
 	scmd = (struct scsi_cmnd *)(rq + 1);
 	scsi_init_command(dev, scmd);
-	scmd->request = rq;
 	scmd->cmnd = scsi_req(rq)->cmd;
 
 	scmd->scsi_done		= scsi_reset_provider_done_command;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 909a422ec8f4..9ba1aa7530a9 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1540,7 +1540,6 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
 
 	scsi_init_command(sdev, cmd);
 
-	cmd->request = req;
 	cmd->tag = req->tag;
 	cmd->prot_op = SCSI_PROT_NORMAL;
 	if (blk_rq_bytes(req))
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index b9265b15d37a..ddc9671b325b 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -111,9 +111,6 @@ struct scsi_cmnd {
 				   reconnects.   Probably == sector
 				   size */
 
-	struct request *request;	/* The command we are
-				   	   working on */
-
 	unsigned char *sense_buffer;
 				/* obtained by REQUEST SENSE when
 				 * CHECK CONDITION is received on original

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (51 preceding siblings ...)
  2021-08-09 23:03 ` [PATCH v5 52/52] core: Remove the request member from struct scsi_cmnd Bart Van Assche
@ 2021-08-10  5:28 ` Martin K. Petersen
  2021-08-10 16:19   ` Bart Van Assche
  2021-08-17  3:17 ` Martin K. Petersen
  53 siblings, 1 reply; 87+ messages in thread
From: Martin K. Petersen @ 2021-08-10  5:28 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi


Hi Bart!

> This patch series implements the following two changes for all SCSI drivers:
> - Use blk_mq_rq_from_pdu() instead of the request member of struct scsi_cmnd
>   since adding an offset to a pointer is faster than pointer indirection.
> - Remove the request pointer from struct scsi_cmnd.

There were failures in storvsc and ufshpb. I fixed them up.

Also rebased my PI series on top and fixed scsi_logical_block_count() to
use scsi_cmd_to_rq().

> Please consider this patch series for kernel v5.14.

A bit too late for 5.14 :)

Applied to 5.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function
  2021-08-09 23:03 ` [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
@ 2021-08-10  6:15   ` Hannes Reinecke
  2021-08-12 12:28   ` Christoph Hellwig
  1 sibling, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:15 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Christoph Hellwig, Ming Lei, James E.J. Bottomley

On 8/10/21 1:03 AM, Bart Van Assche wrote:
> The 'request' member of struct scsi_cmnd is superfluous. The struct
> request and struct scsi_cmnd data structures are adjacent and hence the
> request pointer can be derived easily from a scsi_cmnd pointer. Introduce
> a helper function that performs that conversion in a type-safe way. This
> patch is the first step towards removing the request member from struct
> scsi_cmnd. Making that change has the following advantages:
> - This is a performance optimization since adding an offset to a pointer
>    takes less time than dereferencing a pointer.
> - struct scsi_cmnd becomes smaller.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   include/scsi/scsi_cmnd.h | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
> index 90da9617d28a..e76278ea1fee 100644
> --- a/include/scsi/scsi_cmnd.h
> +++ b/include/scsi/scsi_cmnd.h
> @@ -146,6 +146,12 @@ struct scsi_cmnd {
>   	unsigned int extra_len;	/* length of alignment and padding */
>   };
>   
> +/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */
> +static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd)
> +{
> +	return blk_mq_rq_from_pdu(scmd);
> +}
> +
>   /*
>    * Return the driver private allocation behind the command.
>    * Only works if cmd_size is set in the host template.
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
@ 2021-08-10  6:17   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:17 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Christoph Hellwig, Ming Lei, James E.J. Bottomley

On 8/10/21 1:03 AM, Bart Van Assche wrote:
> Prepare for removal of the request pointer by using scsi_cmd_to_rq()
> instead. Cast away constness where necessary when passing a SCSI command
> pointer to scsi_cmd_to_rq(). This patch does not change any functionality.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/scsi.c         |  2 +-
>   drivers/scsi/scsi_error.c   | 15 ++++++++-------
>   drivers/scsi/scsi_lib.c     | 28 +++++++++++++++-------------
>   drivers/scsi/scsi_logging.c | 18 ++++++++++--------
>   include/scsi/scsi_cmnd.h    |  8 +++++---
>   include/scsi/scsi_device.h  | 16 +++++++++-------
>   6 files changed, 48 insertions(+), 39 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 03/52] sd: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 03/52] sd: " Bart Van Assche
@ 2021-08-10  6:18   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:18 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Christoph Hellwig, Ming Lei, James E.J. Bottomley

On 8/10/21 1:03 AM, 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.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/sd.c     | 33 +++++++++++++++++----------------
>   drivers/scsi/sd_zbc.c | 10 +++++-----
>   2 files changed, 22 insertions(+), 21 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 04/52] sr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 04/52] sr: " Bart Van Assche
@ 2021-08-10  6:18   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:18 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Christoph Hellwig, Ming Lei, Jens Axboe,
	James E.J. Bottomley

On 8/10/21 1:03 AM, 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.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/sr.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 05/52] scsi_transport_fc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 05/52] scsi_transport_fc: " Bart Van Assche
@ 2021-08-10  6:19   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:19 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Christoph Hellwig, Ming Lei, James E.J. Bottomley

On 8/10/21 1:03 AM, 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.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/scsi_transport_fc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> index 49748cd817a5..60e406bcf42a 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -3804,7 +3804,7 @@ bool fc_eh_should_retry_cmd(struct scsi_cmnd *scmd)
>   	struct fc_rport *rport = starget_to_rport(scsi_target(scmd->device));
>   
>   	if ((rport->port_state != FC_PORTSTATE_ONLINE) &&
> -		(scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT)) {
> +		(scsi_cmd_to_rq(scmd)->cmd_flags & REQ_FAILFAST_TRANSPORT)) {
>   		set_host_byte(scmd, DID_TRANSPORT_MARGINAL);
>   		return false;
>   	}
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 06/52] scsi_transport_spi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 06/52] scsi_transport_spi: " Bart Van Assche
@ 2021-08-10  6:19   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:19 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Christoph Hellwig, Ming Lei, James E.J. Bottomley

On 8/10/21 1:03 AM, 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.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/scsi_transport_spi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
> index 5af7a10e9514..bd72c38d7bfc 100644
> --- a/drivers/scsi/scsi_transport_spi.c
> +++ b/drivers/scsi/scsi_transport_spi.c
> @@ -1230,7 +1230,7 @@ int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd)
>   {
>           if (cmd->flags & SCMD_TAGGED) {
>   		*msg++ = SIMPLE_QUEUE_TAG;
> -        	*msg++ = cmd->request->tag;
> +		*msg++ = scsi_cmd_to_rq(cmd)->tag;
>           	return 2;
>   	}
>   
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 07/52] ata: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 07/52] ata: " Bart Van Assche
@ 2021-08-10  6:20   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:20 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Jens Axboe, Christoph Hellwig, Ming Lei

On 8/10/21 1:03 AM, 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.
> 
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/ata/libata-eh.c   |  5 ++---
>   drivers/ata/libata-scsi.c | 10 +++++-----
>   drivers/ata/pata_falcon.c |  4 ++--
>   3 files changed, 9 insertions(+), 10 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 08/52] RDMA/iser: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 08/52] RDMA/iser: " Bart Van Assche
@ 2021-08-10  6:20   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:20 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Max Gurtovoy, Sagi Grimberg, Doug Ledford, Jason Gunthorpe

On 8/10/21 1:03 AM, 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.
> 
> Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/infiniband/ulp/iser/iser_memory.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
> index afec40da9b58..9776b755d848 100644
> --- a/drivers/infiniband/ulp/iser/iser_memory.c
> +++ b/drivers/infiniband/ulp/iser/iser_memory.c
> @@ -159,7 +159,7 @@ iser_set_dif_domain(struct scsi_cmnd *sc, struct ib_sig_domain *domain)
>   {
>   	domain->sig_type = IB_SIG_TYPE_T10_DIF;
>   	domain->sig.dif.pi_interval = scsi_prot_interval(sc);
> -	domain->sig.dif.ref_tag = t10_pi_ref_tag(sc->request);
> +	domain->sig.dif.ref_tag = t10_pi_ref_tag(scsi_cmd_to_rq(sc));
>   	/*
>   	 * At the moment we hard code those, but in the future
>   	 * we will take them from sc.
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 09/52] RDMA/srp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 09/52] RDMA/srp: " Bart Van Assche
@ 2021-08-10  6:21   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:21 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Doug Ledford, Jason Gunthorpe

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 10/52] zfcp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 10/52] zfcp: " Bart Van Assche
@ 2021-08-10  6:21   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:21 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Benjamin Block, Steffen Maier, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

On 8/10/21 1:03 AM, 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.
> 
> Acked-by: Benjamin Block <bblock@linux.ibm.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/s390/scsi/zfcp_fsf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
> index 1990216cf289..6da8f6d05d39 100644
> --- a/drivers/s390/scsi/zfcp_fsf.c
> +++ b/drivers/s390/scsi/zfcp_fsf.c
> @@ -2377,7 +2377,7 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
>   		}
>   	}
>   
> -	blk_add_driver_data(scsi->request, &blktrc, sizeof(blktrc));
> +	blk_add_driver_data(scsi_cmd_to_rq(scsi), &blktrc, sizeof(blktrc));
>   }
>   
>   /**
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 11/52] 53c700: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 11/52] 53c700: " Bart Van Assche
@ 2021-08-10  6:21   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:21 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen; +Cc: linux-scsi, James E.J. Bottomley

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/53c700.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
> index 1c6b4e672687..a12e3525977d 100644
> --- a/drivers/scsi/53c700.c
> +++ b/drivers/scsi/53c700.c
> @@ -1823,7 +1823,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
>   
>   	if ((hostdata->tag_negotiated & (1<<scmd_id(SCp))) &&
>   	    SCp->device->simple_tags) {
> -		slot->tag = SCp->request->tag;
> +		slot->tag = scsi_cmd_to_rq(SCp)->tag;
>   		CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n",
>   		       slot->tag, slot);
>   	} else {
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 12/52] NCR5380: Use sc_data_direction instead of rq_data_dir()
  2021-08-09 23:03 ` [PATCH v5 12/52] NCR5380: Use sc_data_direction instead of rq_data_dir() Bart Van Assche
@ 2021-08-10  6:22   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:22 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Finn Thain, Michael Schmitz, James E.J. Bottomley

On 8/10/21 1:03 AM, Bart Van Assche wrote:
> This patch prepares for the removal of the request pointer from struct
> scsi_cmnd and does not change any functionality.
> 
> Suggested-by: Finn Thain <fthain@linux-m68k.org>
> Acked-by: Finn Thain <fthain@linux-m68k.org>
> Cc: Michael Schmitz <schmitzmic@gmail.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/NCR5380.c   | 6 +++---
>   drivers/scsi/sun3_scsi.c | 3 ++-
>   2 files changed, 5 insertions(+), 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
@ 2021-08-10  6:23   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:23 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Adaptec OEM Raid Solutions, James E.J. Bottomley

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/aacraid/aachba.c  | 2 +-
>   drivers/scsi/aacraid/commsup.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index 267934d2f14b..c2d6f0a9e0b1 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -1504,7 +1504,7 @@ static struct aac_srb * aac_scsi_common(struct fib * fib, struct scsi_cmnd * cmd
>   	srbcmd->id       = cpu_to_le32(scmd_id(cmd));
>   	srbcmd->lun      = cpu_to_le32(cmd->device->lun);
>   	srbcmd->flags    = cpu_to_le32(flag);
> -	timeout = cmd->request->timeout/HZ;
> +	timeout = scsi_cmd_to_rq(cmd)->timeout / HZ;
>   	if (timeout == 0)
>   		timeout = (dev->sa_firmware ? AAC_SA_TIMEOUT : AAC_ARC_TIMEOUT);
>   	srbcmd->timeout  = cpu_to_le32(timeout);  // timeout in seconds
> diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
> index 54eb4d41bc2c..deb32c9f4b3e 100644
> --- a/drivers/scsi/aacraid/commsup.c
> +++ b/drivers/scsi/aacraid/commsup.c
> @@ -224,7 +224,7 @@ struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
>   {
>   	struct fib *fibptr;
>   
> -	fibptr = &dev->fibs[scmd->request->tag];
> +	fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag];
>   	/*
>   	 *	Null out fields that depend on being zero at the start of
>   	 *	each I/O
> 

The 'scsi_cmd_to_rq(scmd)->tag' pattern is becoming more and more 
visible; maybe one should introduce a helper for it?

Other than that:

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 14/52] advansys: " Bart Van Assche
@ 2021-08-10  6:25   ` Hannes Reinecke
  2021-08-10 16:16     ` Bart Van Assche
  2021-08-10 17:25     ` Matthew Wilcox
  0 siblings, 2 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:25 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/advansys.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
> index f3377e2ef5fb..ffb391967573 100644
> --- a/drivers/scsi/advansys.c
> +++ b/drivers/scsi/advansys.c
> @@ -7423,7 +7423,7 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
>   	 * Set the srb_tag to the command tag + 1, as
>   	 * srb_tag '0' is used internally by the chip.
>   	 */
> -	srb_tag = scp->request->tag + 1;
> +	srb_tag = scsi_cmd_to_rq(scp)->tag + 1;
>   	asc_scsi_q->q2.srb_tag = srb_tag;
>   
>   	/*
> @@ -7637,7 +7637,7 @@ static int
>   adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
>   	      adv_req_t **adv_reqpp)
>   {
> -	u32 srb_tag = scp->request->tag;
> +	u32 srb_tag = scsi_cmd_to_rq(scp)->tag;
>   	adv_req_t *reqp;
>   	ADV_SCSI_REQ_Q *scsiqp;
>   	int ret;
> 
Cf the previous patch; we really should introduce a helper to get the 
tag from a SCSI command.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 15/52] aha1542: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 15/52] aha1542: " Bart Van Assche
@ 2021-08-10  6:25   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:25 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen; +Cc: linux-scsi, James E.J. Bottomley

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/aha1542.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 16/52] bnx2i: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 16/52] bnx2i: " Bart Van Assche
@ 2021-08-10  6:26   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:26 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Nilesh Javali, Manish Rangankar,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
> index 43e8a1dafec0..5521469ce678 100644
> --- a/drivers/scsi/bnx2i/bnx2i_hwi.c
> +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
> @@ -1918,7 +1918,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session,
>   
>   	spin_unlock(&session->back_lock);
>   
> -	p = &per_cpu(bnx2i_percpu, blk_mq_rq_cpu(sc->request));
> +	p = &per_cpu(bnx2i_percpu, blk_mq_rq_cpu(scsi_cmd_to_rq(sc)));
>   	spin_lock(&p->p_work_lock);
>   	if (unlikely(!p->iothread)) {
>   		rc = -EINVAL;
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 17/52] csiostor: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 17/52] csiostor: " Bart Van Assche
@ 2021-08-10  6:26   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:26 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, James E.J. Bottomley, Colin Ian King, Jiapeng Chong

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/csiostor/csio_scsi.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
> index 56b9ad0a1ca0..3b2eb6ce1fcf 100644
> --- a/drivers/scsi/csiostor/csio_scsi.c
> +++ b/drivers/scsi/csiostor/csio_scsi.c
> @@ -1786,7 +1786,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)
>   	struct csio_scsi_qset *sqset;
>   	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
>   
> -	sqset = &hw->sqset[ln->portid][blk_mq_rq_cpu(cmnd->request)];
> +	sqset = &hw->sqset[ln->portid][blk_mq_rq_cpu(scsi_cmd_to_rq(cmnd))];
>   
>   	nr = fc_remote_port_chkready(rport);
>   	if (nr) {
> @@ -1989,13 +1989,13 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
>   		csio_info(hw,
>   			"Aborted SCSI command to (%d:%llu) tag %u\n",
>   			cmnd->device->id, cmnd->device->lun,
> -			cmnd->request->tag);
> +			scsi_cmd_to_rq(cmnd)->tag);
>   		return SUCCESS;
>   	} else {
>   		csio_info(hw,
>   			"Failed to abort SCSI command, (%d:%llu) tag %u\n",
>   			cmnd->device->id, cmnd->device->lun,
> -			cmnd->request->tag);
> +			scsi_cmd_to_rq(cmnd)->tag);
>   		return FAILED;
>   	}
>   }
> 
The 'tag' thing again ...

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 18/52] cxlflash: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 18/52] cxlflash: " Bart Van Assche
@ 2021-08-10  6:27   ` Hannes Reinecke
  0 siblings, 0 replies; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-10  6:27 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
	James E.J. Bottomley

On 8/10/21 1:03 AM, 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>
> ---
>   drivers/scsi/cxlflash/main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index 222593bc2afe..2f1894588e0b 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -433,7 +433,7 @@ static u32 cmd_to_target_hwq(struct Scsi_Host *host, struct scsi_cmnd *scp,
>   		hwq = afu->hwq_rr_count++ % afu->num_hwqs;
>   		break;
>   	case HWQ_MODE_TAG:
> -		tag = blk_mq_unique_tag(scp->request);
> +		tag = blk_mq_unique_tag(scsi_cmd_to_rq(scp));
>   		hwq = blk_mq_unique_tag_to_hwq(tag);
>   		break;
>   	case HWQ_MODE_CPU:
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-10  6:25   ` Hannes Reinecke
@ 2021-08-10 16:16     ` Bart Van Assche
  2021-08-12  2:58       ` Martin K. Petersen
  2021-08-10 17:25     ` Matthew Wilcox
  1 sibling, 1 reply; 87+ messages in thread
From: Bart Van Assche @ 2021-08-10 16:16 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K . Petersen
  Cc: linux-scsi, Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley

On 8/9/21 11:25 PM, Hannes Reinecke wrote:
> On 8/10/21 1:03 AM, 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>
>> ---
>>   drivers/scsi/advansys.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
>> index f3377e2ef5fb..ffb391967573 100644
>> --- a/drivers/scsi/advansys.c
>> +++ b/drivers/scsi/advansys.c
>> @@ -7423,7 +7423,7 @@ static int asc_build_req(struct asc_board 
>> *boardp, struct scsi_cmnd *scp,
>>        * Set the srb_tag to the command tag + 1, as
>>        * srb_tag '0' is used internally by the chip.
>>        */
>> -    srb_tag = scp->request->tag + 1;
>> +    srb_tag = scsi_cmd_to_rq(scp)->tag + 1;
>>       asc_scsi_q->q2.srb_tag = srb_tag;
>>       /*
>> @@ -7637,7 +7637,7 @@ static int
>>   adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
>>             adv_req_t **adv_reqpp)
>>   {
>> -    u32 srb_tag = scp->request->tag;
>> +    u32 srb_tag = scsi_cmd_to_rq(scp)->tag;
>>       adv_req_t *reqp;
>>       ADV_SCSI_REQ_Q *scsiqp;
>>       int ret;
>>
> Cf the previous patch; we really should introduce a helper to get the 
> tag from a SCSI command.

Hi Hannes,

Is this something that you plan to work on or do you perhaps expect me 
to introduce such a helper?

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd
  2021-08-10  5:28 ` [PATCH v5 00/52] Remove the request pointer " Martin K. Petersen
@ 2021-08-10 16:19   ` Bart Van Assche
  0 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-10 16:19 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: linux-scsi

On 8/9/21 10:28 PM, Martin K. Petersen wrote:
>> This patch series implements the following two changes for all SCSI drivers:
>> - Use blk_mq_rq_from_pdu() instead of the request member of struct scsi_cmnd
>>    since adding an offset to a pointer is faster than pointer indirection.
>> - Remove the request pointer from struct scsi_cmnd.
> 
> There were failures in storvsc and ufshpb. I fixed them up.

Hmm ... the basis of this patch series is commit 40fd8845c025 ("scsi: 
target: core: Drop unnecessary se_cmd ASC/ASCQ members"). That was the 
tip of the staging branch up until about two days ago. I'm not sure what 
I missed?

> Also rebased my PI series on top and fixed scsi_logical_block_count() to
> use scsi_cmd_to_rq().

Thanks!

>> Please consider this patch series for kernel v5.14.
> 
> A bit too late for 5.14 :)

Right, that part of the cover letter should have been updated.

Bart.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-10  6:25   ` Hannes Reinecke
  2021-08-10 16:16     ` Bart Van Assche
@ 2021-08-10 17:25     ` Matthew Wilcox
  1 sibling, 0 replies; 87+ messages in thread
From: Matthew Wilcox @ 2021-08-10 17:25 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Bart Van Assche, Martin K . Petersen, linux-scsi,
	Hannes Reinecke, James E.J. Bottomley

On Tue, Aug 10, 2021 at 08:25:16AM +0200, Hannes Reinecke wrote:
> > +	srb_tag = scsi_cmd_to_rq(scp)->tag + 1;
> Cf the previous patch; we really should introduce a helper to get the tag
> from a SCSI command.

scsi_cmd_tag(scp) ?

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-10 16:16     ` Bart Van Assche
@ 2021-08-12  2:58       ` Martin K. Petersen
  2021-08-12  4:03         ` Bart Van Assche
                           ` (2 more replies)
  0 siblings, 3 replies; 87+ messages in thread
From: Martin K. Petersen @ 2021-08-12  2:58 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Hannes Reinecke, Martin K . Petersen, linux-scsi, Matthew Wilcox,
	Hannes Reinecke, James E.J. Bottomley


Bart,

>> Cf the previous patch; we really should introduce a helper to get
>> the tag from a SCSI command.
>
> Is this something that you plan to work on or do you perhaps expect me
> to introduce such a helper?

I agree that getting the tag is a common operation and I had the same
thought as Hannes when I reviewed the patches.

Adding a dedicated wrapper would result in the diff below. However,
after having gone through this exercise, I'm not sure it's worth the
additional churn...

Thoughts?

-- 
Martin K. Petersen	Oracle Linux Engineering

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f7f630485465..ef2c3a3c9f7c 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -631,7 +631,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
 {
 	struct ata_queued_cmd *qc;
 
-	qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
+	qc = ata_qc_new_init(dev, scsi_cmd_to_tag(cmd));
 	if (qc) {
 		qc->scsicmd = cmd;
 		qc->scsidone = cmd->scsi_done;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index a12e3525977d..6595b394bbf4 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1823,7 +1823,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
 
 	if ((hostdata->tag_negotiated & (1<<scmd_id(SCp))) &&
 	    SCp->device->simple_tags) {
-		slot->tag = scsi_cmd_to_rq(SCp)->tag;
+		slot->tag = scsi_cmd_to_tag(SCp);
 		CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n",
 		       slot->tag, slot);
 	} else {
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index deb32c9f4b3e..563e93cc3b9a 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -224,7 +224,7 @@ struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
 {
 	struct fib *fibptr;
 
-	fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag];
+	fibptr = &dev->fibs[scsi_cmd_to_tag(scmd)];
 	/*
 	 *	Null out fields that depend on being zero at the start of
 	 *	each I/O
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index ffb391967573..c536ea9c9e6f 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7423,7 +7423,7 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
 	 * Set the srb_tag to the command tag + 1, as
 	 * srb_tag '0' is used internally by the chip.
 	 */
-	srb_tag = scsi_cmd_to_rq(scp)->tag + 1;
+	srb_tag = scsi_cmd_to_tag(scp) + 1;
 	asc_scsi_q->q2.srb_tag = srb_tag;
 
 	/*
@@ -7637,7 +7637,7 @@ static int
 adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
 	      adv_req_t **adv_reqpp)
 {
-	u32 srb_tag = scsi_cmd_to_rq(scp)->tag;
+	u32 srb_tag = scsi_cmd_to_tag(scp);
 	adv_req_t *reqp;
 	ADV_SCSI_REQ_Q *scsiqp;
 	int ret;
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 3b2eb6ce1fcf..f4019fdf39f4 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1989,13 +1989,13 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
 		csio_info(hw,
 			"Aborted SCSI command to (%d:%llu) tag %u\n",
 			cmnd->device->id, cmnd->device->lun,
-			scsi_cmd_to_rq(cmnd)->tag);
+			scsi_cmd_to_tag(cmnd));
 		return SUCCESS;
 	} else {
 		csio_info(hw,
 			"Failed to abort SCSI command, (%d:%llu) tag %u\n",
 			cmnd->device->id, cmnd->device->lun,
-			scsi_cmd_to_rq(cmnd)->tag);
+			scsi_cmd_to_tag(cmnd));
 		return FAILED;
 	}
 }
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 7af96d14c9bc..855113bc028f 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -652,7 +652,7 @@ static int adpt_abort(struct scsi_cmnd * cmd)
 	msg[2] = 0;
 	msg[3]= 0;
 	/* Add 1 to avoid firmware treating it as invalid command */
-	msg[4] = scsi_cmd_to_rq(cmd)->tag + 1;
+	msg[4] = scsi_cmd_to_tag(cmd) + 1;
 	if (pHba->host)
 		spin_lock_irq(pHba->host->host_lock);
 	rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
@@ -2236,7 +2236,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
 	msg[1] = ((0xff<<24)|(HOST_TID<<12)|d->tid);
 	msg[2] = 0;
 	/* Add 1 to avoid firmware treating it as invalid command */
-	msg[3] = scsi_cmd_to_rq(cmd)->tag + 1;
+	msg[3] = scsi_cmd_to_tag(cmd) + 1;
 	// Our cards use the transaction context as the tag for queueing
 	// Adaptec/DPT Private stuff 
 	msg[4] = I2O_CMD_SCSI_EXEC|(DPT_ORGANIZATION_ID<<16);
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 0f9cedf78872..aa8ed0f9fd32 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -107,7 +107,7 @@ static void fnic_cleanup_io(struct fnic *fnic);
 static inline spinlock_t *fnic_io_lock_hash(struct fnic *fnic,
 					    struct scsi_cmnd *sc)
 {
-	u32 hash = scsi_cmd_to_rq(sc)->tag & (FNIC_IO_LOCKS - 1);
+	u32 hash = scsi_cmd_to_tag(sc) & (FNIC_IO_LOCKS - 1);
 
 	return &fnic->io_req_lock[hash];
 }
@@ -390,7 +390,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
 	    (rp->flags & FC_RP_FLAGS_RETRY))
 		exch_flags |= FCPIO_ICMND_SRFLAG_RETRY;
 
-	fnic_queue_wq_copy_desc_icmnd_16(wq, scsi_cmd_to_rq(sc)->tag,
+	fnic_queue_wq_copy_desc_icmnd_16(wq, scsi_cmd_to_tag(sc),
 					 0, exch_flags, io_req->sgl_cnt,
 					 SCSI_SENSE_BUFFERSIZE,
 					 io_req->sgl_list_pa,
@@ -422,7 +422,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
  */
 static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
 {
-	const int tag = scsi_cmd_to_rq(sc)->tag;
+	const int tag = scsi_cmd_to_tag(sc);
 	struct fc_lport *lp = shost_priv(sc->device->host);
 	struct fc_rport *rport;
 	struct fnic_io_req *io_req = NULL;
@@ -1363,7 +1363,7 @@ int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do)
 static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
 				 bool reserved)
 {
-	const int tag = scsi_cmd_to_rq(sc)->tag;
+	const int tag = scsi_cmd_to_tag(sc);
 	struct fnic *fnic = data;
 	struct fnic_io_req *io_req;
 	unsigned long flags = 0;
@@ -1566,7 +1566,7 @@ static bool fnic_rport_abort_io_iter(struct scsi_cmnd *sc, void *data,
 {
 	struct fnic_rport_abort_io_iter_data *iter_data = data;
 	struct fnic *fnic = iter_data->fnic;
-	int abt_tag = scsi_cmd_to_rq(sc)->tag;
+	int abt_tag = scsi_cmd_to_tag(sc);
 	struct fnic_io_req *io_req;
 	spinlock_t *io_lock;
 	unsigned long flags;
@@ -1993,7 +1993,7 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic,
 	/* fill in the lun info */
 	int_to_scsilun(sc->device->lun, &fc_lun);
 
-	fnic_queue_wq_copy_desc_itmf(wq, scsi_cmd_to_rq(sc)->tag | FNIC_TAG_DEV_RST,
+	fnic_queue_wq_copy_desc_itmf(wq, scsi_cmd_to_tag(sc) | FNIC_TAG_DEV_RST,
 				     0, FCPIO_ITMF_LUN_RESET, SCSI_NO_TAG,
 				     fc_lun.scsi_lun, io_req->port_id,
 				     fnic->config.ra_tov, fnic->config.ed_tov);
@@ -2024,7 +2024,7 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,
 	struct fnic_pending_aborts_iter_data *iter_data = data;
 	struct fnic *fnic = iter_data->fnic;
 	struct scsi_device *lun_dev = iter_data->lun_dev;
-	int abt_tag = scsi_cmd_to_rq(sc)->tag;
+	int abt_tag = scsi_cmd_to_tag(sc);
 	struct fnic_io_req *io_req;
 	spinlock_t *io_lock;
 	unsigned long flags;
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 9515c45affa5..45397c422727 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -185,7 +185,7 @@ static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
 	void *bitmap = hisi_hba->slot_index_tags;
 
 	if (scsi_cmnd)
-		return scsi_cmd_to_rq(scsi_cmnd)->tag;
+		return scsi_cmd_to_tag(scsi_cmnd);
 
 	spin_lock(&hisi_hba->lock);
 	index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3faa87fa296a..e330d3ac19a8 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5686,7 +5686,7 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 	/* Get the ptr to our adapter structure out of cmd->host. */
 	h = sdev_to_hba(cmd->device);
 
-	BUG_ON(scsi_cmd_to_rq(cmd)->tag < 0);
+	BUG_ON(scsi_cmd_to_tag(cmd) < 0);
 
 	dev = cmd->device->hostdata;
 	if (!dev) {
@@ -5894,7 +5894,7 @@ static int hpsa_scsi_add_host(struct ctlr_info *h)
  */
 static int hpsa_get_cmd_index(struct scsi_cmnd *scmd)
 {
-	int idx = scsi_cmd_to_rq(scmd)->tag;
+	int idx = scsi_cmd_to_tag(scmd);
 
 	if (idx < 0)
 		return idx;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 26d0cf9353dd..77401a61ba5b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3381,7 +3381,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 		return SCSI_MLQUEUE_HOST_BUSY;
 	}
 
-	cmd = megasas_get_cmd_fusion(instance, scsi_cmd_to_rq(scmd)->tag);
+	cmd = megasas_get_cmd_fusion(instance, scsi_cmd_to_tag(scmd));
 
 	if (!cmd) {
 		atomic_dec(&instance->fw_outstanding);
@@ -3422,7 +3422,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 	 */
 	if (cmd->r1_alt_dev_handle != MR_DEVHANDLE_INVALID) {
 		r1_cmd = megasas_get_cmd_fusion(instance,
-				scsi_cmd_to_rq(scmd)->tag + instance->max_fw_cmds);
+				scsi_cmd_to_tag(scmd) + instance->max_fw_cmds);
 		megasas_prepare_secondRaid1_IO(instance, cmd, r1_cmd);
 	}
 
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 4d251bf630a3..38d6e4b61e81 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -702,7 +702,7 @@ static int mvumi_host_reset(struct scsi_cmnd *scmd)
 	mhba = (struct mvumi_hba *) scmd->device->host->hostdata;
 
 	scmd_printk(KERN_NOTICE, scmd, "RESET -%u cmd=%x retries=%x\n",
-			scsi_cmd_to_rq(scmd)->tag, scmd->cmnd[0], scmd->retries);
+			scsi_cmd_to_tag(scmd), scmd->cmnd[0], scmd->retries);
 
 	return mhba->instancet->reset_host(mhba);
 }
diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index a4a88323e020..fe280b349b2f 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -1551,7 +1551,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
 	}
 
 	myrb_reset_cmd(cmd_blk);
-	mbox->type5.id = scsi_cmd_to_rq(scmd)->tag + 3;
+	mbox->type5.id = scsi_cmd_to_tag(scmd) + 3;
 	if (scmd->sc_data_direction == DMA_NONE)
 		goto submit;
 	nsge = scsi_dma_map(scmd);
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index 28eab07935ba..93eaed02a60d 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -288,7 +288,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
 	/* Acquire hardware specific lock */
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 
-	index = scsi_cmd_to_rq(cmd)->tag;
+	index = scsi_cmd_to_tag(cmd);
 
 	/*
 	 * Check to see if adapter is online before placing request on
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 31529d8add0d..5b892b043716 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -5588,7 +5588,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 			sd_dp->issuing_cpu = raw_smp_processor_id();
 		if (unlikely(sd_dp->aborted)) {
 			sdev_printk(KERN_INFO, sdp, "abort request tag %d\n",
-				    scsi_cmd_to_rq(cmnd)->tag);
+				    scsi_cmd_to_tag(cmnd));
 			blk_abort_request(scsi_cmd_to_rq(cmnd));
 			atomic_set(&sdeb_inject_pending, 0);
 			sd_dp->aborted = false;
diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index ed9572252a42..7a5fa30f1ad7 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -92,7 +92,7 @@ void scmd_printk(const char *level, const struct scsi_cmnd *scmd,
 	if (!logbuf)
 		return;
 	off = sdev_format_header(logbuf, logbuf_len, scmd_name(scmd),
-				 scsi_cmd_to_rq((struct scsi_cmnd *)scmd)->tag);
+				 scsi_cmd_to_tag((struct scsi_cmnd *)scmd));
 	if (off < logbuf_len) {
 		va_start(args, fmt);
 		off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
@@ -189,7 +189,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
 		return;
 
 	off = sdev_format_header(logbuf, logbuf_len,
-				 scmd_name(cmd), scsi_cmd_to_rq(cmd)->tag);
+				 scmd_name(cmd), scsi_cmd_to_tag(cmd));
 	if (off >= logbuf_len)
 		goto out_printk;
 	off += scnprintf(logbuf + off, logbuf_len - off, "CDB: ");
@@ -211,7 +211,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
 
 			off = sdev_format_header(logbuf, logbuf_len,
 						 scmd_name(cmd),
-						 scsi_cmd_to_rq(cmd)->tag);
+						 scsi_cmd_to_tag(cmd));
 			if (!WARN_ON(off > logbuf_len - 58)) {
 				off += scnprintf(logbuf + off, logbuf_len - off,
 						 "CDB[%02x]: ", k);
@@ -375,7 +375,7 @@ EXPORT_SYMBOL(__scsi_print_sense);
 void scsi_print_sense(const struct scsi_cmnd *cmd)
 {
 	scsi_log_print_sense(cmd->device, scmd_name(cmd),
-			     scsi_cmd_to_rq((struct scsi_cmnd *)cmd)->tag,
+			     scsi_cmd_to_tag((struct scsi_cmnd *)cmd),
 			     cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
 }
 EXPORT_SYMBOL(scsi_print_sense);
@@ -394,7 +394,7 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
 		return;
 
 	off = sdev_format_header(logbuf, logbuf_len, scmd_name(cmd),
-				 scsi_cmd_to_rq((struct scsi_cmnd *)cmd)->tag);
+				 scsi_cmd_to_tag((struct scsi_cmnd *)cmd));
 
 	if (off >= logbuf_len)
 		goto out_printk;
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index bd72c38d7bfc..c878d692eec3 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1230,7 +1230,7 @@ int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd)
 {
         if (cmd->flags & SCMD_TAGGED) {
 		*msg++ = SIMPLE_QUEUE_TAG;
-		*msg++ = scsi_cmd_to_rq(cmd)->tag;
+		*msg++ = scsi_cmd_to_tag(cmd);
         	return 2;
 	}
 
diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 95740caa1eb0..6bdabb60f58f 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -33,7 +33,7 @@
 #include "snic_io.h"
 #include "snic.h"
 
-#define snic_cmd_tag(sc)	(scsi_cmd_to_rq(sc)->tag)
+#define snic_cmd_tag(sc)	(scsi_cmd_to_tag(sc))
 
 const char *snic_state_str[] = {
 	[SNIC_INIT]	= "SNIC_INIT",
@@ -2494,7 +2494,7 @@ snic_scsi_cleanup(struct snic *snic, int ex_tag)
 		sc->result = DID_TRANSPORT_DISRUPTED << 16;
 		SNIC_HOST_INFO(snic->shost,
 			       "sc_clean: DID_TRANSPORT_DISRUPTED for sc %p, Tag %d flags 0x%llx rqi %p duration %u msecs\n",
-			       sc, scsi_cmd_to_rq(sc)->tag, CMD_FLAGS(sc), rqi,
+			       sc, snic_cmd_tag(sc), CMD_FLAGS(sc), rqi,
 			       jiffies_to_msecs(jiffies - st_time));
 
 		/* Update IO stats */
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index f1ba7f5b52a8..3b8d788c6eda 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -690,7 +690,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 
 	cmd->scsi_done = done;
 
-	tag = scsi_cmd_to_rq(cmd)->tag;
+	tag = scsi_cmd_to_tag(cmd);
 
 	if (unlikely(tag >= host->can_queue))
 		return SCSI_MLQUEUE_HOST_BUSY;
@@ -1246,7 +1246,7 @@ static int stex_abort(struct scsi_cmnd *cmd)
 {
 	struct Scsi_Host *host = cmd->device->host;
 	struct st_hba *hba = (struct st_hba *)host->hostdata;
-	u16 tag = scsi_cmd_to_rq(cmd)->tag;
+	u16 tag = scsi_cmd_to_tag(cmd);
 	void __iomem *base;
 	u32 data;
 	int result = SUCCESS;
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index e2278b0125e7..c3217ca78428 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1202,7 +1202,7 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,
 	    vstor_packet->vm_srb.srb_status != SRB_STATUS_SUCCESS)
 		storvsc_log(device, STORVSC_LOGGING_ERROR,
 			"tag#%d cmd 0x%x status: scsi 0x%x srb 0x%x hv 0x%x\n",
-			scsi_cmd_to_rq(request->cmd)->tag,
+			scsi_cmd_to_tag(request->cmd),
 			stor_pkt->vm_srb.cdb[0],
 			vstor_packet->vm_srb.scsi_status,
 			vstor_packet->vm_srb.srb_status,
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a3b419848f0a..a83981cc8b1b 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2676,7 +2676,7 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
 static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 {
 	struct ufs_hba *hba = shost_priv(host);
-	int tag = scsi_cmd_to_rq(cmd)->tag;
+	int tag = scsi_cmd_to_tag(cmd);
 	struct ufshcd_lrb *lrbp;
 	int err = 0;
 
@@ -6994,7 +6994,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
 {
 	struct Scsi_Host *host = cmd->device->host;
 	struct ufs_hba *hba = shost_priv(host);
-	int tag = scsi_cmd_to_rq(cmd)->tag;
+	int tag = scsi_cmd_to_tag(cmd);
 	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	unsigned long flags;
 	int err = FAILED;
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 3dfc7ed79ba4..684a48a1cdb8 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -183,7 +183,7 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
 
 	memset(tl_cmd, 0, sizeof(*tl_cmd));
 	tl_cmd->sc = sc;
-	tl_cmd->sc_cmd_tag = scsi_cmd_to_rq(sc)->tag;
+	tl_cmd->sc_cmd_tag = scsi_cmd_to_tag(sc);
 
 	tcm_loop_target_queue_cmd(tl_cmd);
 	return 0;
@@ -249,7 +249,7 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc)
 	tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
 	tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
 	ret = tcm_loop_issue_tmr(tl_tpg, sc->device->lun,
-				 scsi_cmd_to_rq(sc)->tag, TMR_ABORT_TASK);
+				 scsi_cmd_to_tag(sc), TMR_ABORT_TASK);
 	return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED;
 }
 
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 6c5a1c1c6b1e..99a1c61cda46 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -149,6 +149,11 @@ static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd)
 	return blk_mq_rq_from_pdu(scmd);
 }
 
+static inline int scsi_cmd_to_tag(struct scsi_cmnd *scmd)
+{
+	return blk_mq_rq_from_pdu(scmd)->tag;
+}
+
 /*
  * Return the driver private allocation behind the command.
  * Only works if cmd_size is set in the host template.

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-12  2:58       ` Martin K. Petersen
@ 2021-08-12  4:03         ` Bart Van Assche
  2021-08-12  6:03         ` Hannes Reinecke
  2021-08-13  2:19         ` Matthew Wilcox
  2 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-12  4:03 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Hannes Reinecke, linux-scsi, Matthew Wilcox, Hannes Reinecke,
	James E.J. Bottomley

On 8/11/21 7:58 PM, Martin K. Petersen wrote:
> Adding a dedicated wrapper would result in the diff below. However,
> after having gone through this exercise, I'm not sure it's worth the
> additional churn...

Hi Martin,

Thanks for having looked to this. I share your opinion: I'm not sure
either it's worth the additional churn.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-12  2:58       ` Martin K. Petersen
  2021-08-12  4:03         ` Bart Van Assche
@ 2021-08-12  6:03         ` Hannes Reinecke
  2021-08-12  9:05           ` John Garry
  2021-08-13  2:19         ` Matthew Wilcox
  2 siblings, 1 reply; 87+ messages in thread
From: Hannes Reinecke @ 2021-08-12  6:03 UTC (permalink / raw)
  To: Martin K. Petersen, Bart Van Assche
  Cc: linux-scsi, Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley

On 8/12/21 4:58 AM, Martin K. Petersen wrote:
> 
> Bart,
> 
>>> Cf the previous patch; we really should introduce a helper to get
>>> the tag from a SCSI command.
>>
>> Is this something that you plan to work on or do you perhaps expect me
>> to introduce such a helper?
> 
> I agree that getting the tag is a common operation and I had the same
> thought as Hannes when I reviewed the patches.
> 
> Adding a dedicated wrapper would result in the diff below. However,
> after having gone through this exercise, I'm not sure it's worth the
> additional churn...
> 
> Thoughts?
> 
Go for it.
I'm not particularly keen on the 'scsi_cmd_to_rq(cmd)->tag' construct, 
as this implies that 'scsi_cmd_to_rq()' has to be a define, not a function.
Having a wrapper for scsi_cmd_to_tag() resolves that.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-12  6:03         ` Hannes Reinecke
@ 2021-08-12  9:05           ` John Garry
  2021-08-13  1:42             ` Bart Van Assche
  0 siblings, 1 reply; 87+ messages in thread
From: John Garry @ 2021-08-12  9:05 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen, Bart Van Assche
  Cc: linux-scsi, Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley

On 12/08/2021 07:03, Hannes Reinecke wrote:
> Go for it.
> I'm not particularly keen on the 'scsi_cmd_to_rq(cmd)->tag' construct, 
> as this implies that 'scsi_cmd_to_rq()' has to be a define, not a function.

What is the problem exactly?

> Having a wrapper for scsi_cmd_to_tag() resolves that.

So which tag does scsi_cmd_to_tag() return? The request tag? 
scsi_cmnd.tag? Or, if there is an ata_queued_cmd associated with the 
scsi_cmnd, ata_queued_cmd.tag? Maybe it's blindingly obvious, but I 
don't see value in introducing possibility of misuse.

Having said that, scsi_cmnd.tag could be removed:

---->8----

[PATCH 1/3] scsi: wd719: Stop using scsi_cmnd.tag

Use scsi_cmd_to_rq(cmd)->tag instead.

Signed-off-by: John Garry <john.garry@huawei.com>
---
  drivers/scsi/wd719x.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index edc8a139a60d..4f4ebb9c5b09 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -467,13 +467,13 @@ static int wd719x_abort(struct scsi_cmnd *cmd)
  	struct wd719x_scb *scb = scsi_cmd_priv(cmd);
  	struct wd719x *wd = shost_priv(cmd->device->host);

-	dev_info(&wd->pdev->dev, "abort command, tag: %x\n", cmd->tag);
+	dev_info(&wd->pdev->dev, "abort command, tag: %x\n", 
scsi_cmd_to_rq(cmd)->tag);

-	action = /*cmd->tag ? WD719X_CMD_ABORT_TAG : */WD719X_CMD_ABORT;
+	action = /*scsi_cmd_to_rq(cmd)->tag ? WD719X_CMD_ABORT_TAG : 
*/WD719X_CMD_ABORT;

  	spin_lock_irqsave(wd->sh->host_lock, flags);
  	result = wd719x_direct_cmd(wd, action, cmd->device->id,
-				   cmd->device->lun, cmd->tag, scb->phys, 0);
+				   cmd->device->lun, scsi_cmd_to_rq(cmd)->tag, scb->phys, 0);
  	wd719x_finish_cmd(scb, DID_ABORT);
  	spin_unlock_irqrestore(wd->sh->host_lock, flags);
  	if (result)
-- 
[PATCH 2/3] scsi: fnic: Stop setting scsi_cmnd.tag

It is never read. Setting it and the request tag seems dodgy
anyway.

Signed-off-by: John Garry <john.garry@huawei.com>
---
  drivers/scsi/fnic/fnic_scsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 0f9cedf78872..f8afbfb468dc 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2213,7 +2213,7 @@ fnic_scsi_host_start_tag(struct fnic *fnic, struct 
scsi_cmnd *sc)
  	if (IS_ERR(dummy))
  		return SCSI_NO_TAG;

-	sc->tag = rq->tag = dummy->tag;
+	rq->tag = dummy->tag;
  	sc->host_scribble = (unsigned char *)dummy;

  	return dummy->tag;
-- 
[PATCH 3/3] scsi: Remove scsi_cmnd.tag

There are no users.

Signed-off-by: John Garry <john.garry@huawei.com>
---
  drivers/scsi/scsi_lib.c  | 1 -
  include/scsi/scsi_cmnd.h | 1 -
  2 files changed, 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 9ba1aa7530a9..572673873ddf 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1540,7 +1540,6 @@ static blk_status_t scsi_prepare_cmd(struct 
request *req)

  	scsi_init_command(sdev, cmd);

-	cmd->tag = req->tag;
  	cmd->prot_op = SCSI_PROT_NORMAL;
  	if (blk_rq_bytes(req))
  		cmd->sc_data_direction = rq_dma_dir(req);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 6c5a1c1c6b1e..eaf04c9a1dfc 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -139,7 +139,6 @@ struct scsi_cmnd {
  	int flags;		/* Command flags */
  	unsigned long state;	/* Command completion state */

-	unsigned char tag;	/* SCSI-II queued command tag */
  	unsigned int extra_len;	/* length of alignment and padding */
  };

-- 

----8<-----

Bart, feel free to make a similar change - I don't want you to think I'm 
hijacking your work.

Thanks!

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function
  2021-08-09 23:03 ` [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
  2021-08-10  6:15   ` Hannes Reinecke
@ 2021-08-12 12:28   ` Christoph Hellwig
  2021-08-12 18:19     ` Bart Van Assche
  1 sibling, 1 reply; 87+ messages in thread
From: Christoph Hellwig @ 2021-08-12 12:28 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Christoph Hellwig,
	Hannes Reinecke, Ming Lei, James E.J. Bottomley

This seems to miss a cover letter and about 40 or your 52 patches.  No
idea how I am supposed to review it.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function
  2021-08-12 12:28   ` Christoph Hellwig
@ 2021-08-12 18:19     ` Bart Van Assche
  0 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-12 18:19 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Martin K . Petersen, linux-scsi, Hannes Reinecke, Ming Lei,
	James E.J. Bottomley

On 8/12/21 5:28 AM, Christoph Hellwig wrote:
> This seems to miss a cover letter and about 40 or your 52 patches.  No
> idea how I am supposed to review it.

Hi Christoph,

Could this be an issue related to the server that supports your email 
inbox? As one can see here, the lore list server received all 53 emails: 
https://lore.kernel.org/linux-scsi/a6563829-2e1e-8117-de45-876004a288ff@acm.org/T/#t

Thanks,

Bart.



^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-12  9:05           ` John Garry
@ 2021-08-13  1:42             ` Bart Van Assche
  0 siblings, 0 replies; 87+ messages in thread
From: Bart Van Assche @ 2021-08-13  1:42 UTC (permalink / raw)
  To: John Garry, Hannes Reinecke, Martin K. Petersen
  Cc: linux-scsi, Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley

On 8/12/21 2:05 AM, John Garry wrote:
> Bart, feel free to make a similar change - I don't want you to think I'm
> hijacking your work.

Hi John,

Since these patches are your work: do you perhaps want to post these
patches as a series? In case you want me to post these patches as a
series, I'd like to keep your name and email address in the git
"Author:" field.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-12  2:58       ` Martin K. Petersen
  2021-08-12  4:03         ` Bart Van Assche
  2021-08-12  6:03         ` Hannes Reinecke
@ 2021-08-13  2:19         ` Matthew Wilcox
  2 siblings, 0 replies; 87+ messages in thread
From: Matthew Wilcox @ 2021-08-13  2:19 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Bart Van Assche, Hannes Reinecke, linux-scsi, Hannes Reinecke,
	James E.J. Bottomley

On Wed, Aug 11, 2021 at 10:58:10PM -0400, Martin K. Petersen wrote:
> Thoughts?

Seems a bit verbose to me.

> -	qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
> +	qc = ata_qc_new_init(dev, scsi_cmd_to_tag(cmd));

	qc = ata_qc_new_init(dev, scmd_tag(cmd));

would fit with scmd_printk(), scmd_id(), scmd_channel(), etc.


^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 29/52] mpi3mr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 29/52] mpi3mr: " Bart Van Assche
@ 2021-08-16  8:32   ` Kashyap Desai
  2021-08-16 17:13     ` Martin K. Petersen
  0 siblings, 1 reply; 87+ messages in thread
From: Kashyap Desai @ 2021-08-16  8:32 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Sathya Prakash Veerichetty,
	Sumit Saxena, Sreekanth Reddy, James E.J. Bottomley

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/mpi3mr/mpi3mr_os.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
> index 24ac7ddec749..bc1c32f599de 100644
> --- a/drivers/scsi/mpi3mr/mpi3mr_os.c
> +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
> @@ -50,7 +50,7 @@ static u16 mpi3mr_host_tag_for_scmd(struct mpi3mr_ioc *mrioc,
>         u32 unique_tag;
>         u16 host_tag, hw_queue;
>
> -       unique_tag = blk_mq_unique_tag(scmd->request);
> +       unique_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
>
>         hw_queue = blk_mq_unique_tag_to_hwq(unique_tag);
>         if (hw_queue >= mrioc->num_op_reply_q)
> @@ -2016,7 +2016,7 @@ static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc,
>         case SCSI_PROT_DIF_TYPE0:
>                 eedp_flags |= MPI3_EEDPFLAGS_INCR_PRI_REF_TAG;
>                 scsiio_req->cdb.eedp32.primary_reference_tag =
> -                   cpu_to_be32(t10_pi_ref_tag(scmd->request));
> +                   cpu_to_be32(t10_pi_ref_tag(scsi_cmd_to_rq(scmd)));
>                 break;
>         case SCSI_PROT_DIF_TYPE1:
>         case SCSI_PROT_DIF_TYPE2:
> @@ -2024,7 +2024,7 @@ static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc,
>                     MPI3_EEDPFLAGS_ESC_MODE_APPTAG_DISABLE |
>                     MPI3_EEDPFLAGS_CHK_GUARD;
>                 scsiio_req->cdb.eedp32.primary_reference_tag =
> -                   cpu_to_be32(t10_pi_ref_tag(scmd->request));
> +                   cpu_to_be32(t10_pi_ref_tag(scsi_cmd_to_rq(scmd)));
Bart,

t10_pi_ref_tag API is replaced by scsi_prot_ref_tag in the patch below
posted by Martin.

https://patchwork.kernel.org/project/linux-scsi/patch/20210806040023.5355-4-martin.petersen@oracle.com/

Rebase is required for mpi3mr and mpt3sas driver changes in this series.

Kashyap

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 29/52] mpi3mr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-16  8:32   ` Kashyap Desai
@ 2021-08-16 17:13     ` Martin K. Petersen
  0 siblings, 0 replies; 87+ messages in thread
From: Martin K. Petersen @ 2021-08-16 17:13 UTC (permalink / raw)
  To: Kashyap Desai
  Cc: Bart Van Assche, Martin K . Petersen, linux-scsi,
	Sathya Prakash Veerichetty, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley


Kashyap,

> t10_pi_ref_tag API is replaced by scsi_prot_ref_tag in the patch below
> posted by Martin.

> Rebase is required for mpi3mr and mpt3sas driver changes in this series.

I fixed this conflict when I merged the series.

The corresponding mpt3sas patch caused a zeroday warning and had a
bug. Posting a fixed version shortly.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd
  2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
                   ` (52 preceding siblings ...)
  2021-08-10  5:28 ` [PATCH v5 00/52] Remove the request pointer " Martin K. Petersen
@ 2021-08-17  3:17 ` Martin K. Petersen
  53 siblings, 0 replies; 87+ messages in thread
From: Martin K. Petersen @ 2021-08-17  3:17 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi

On Mon, 9 Aug 2021 16:03:03 -0700, Bart Van Assche wrote:

> This patch series implements the following two changes for all SCSI drivers:
> - Use blk_mq_rq_from_pdu() instead of the request member of struct scsi_cmnd
>   since adding an offset to a pointer is faster than pointer indirection.
> - Remove the request pointer from struct scsi_cmnd.
> 
> Please consider this patch series for kernel v5.14.
> 
> [...]

Applied to 5.15/scsi-queue, thanks!

[01/52] core: Introduce the scsi_cmd_to_rq() function
        https://git.kernel.org/mkp/scsi/c/51f3a4788928
[02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/aa8e25e5006a
[03/52] sd: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/5999ccff0fd6
[04/52] sr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/c4deb5b5ddd4
[05/52] scsi_transport_fc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/3b4720fc8d1c
[06/52] scsi_transport_spi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/eb43d41de291
[07/52] ata: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/c8329cd55bf4
[08/52] RDMA/iser: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/99247108c0f2
[09/52] RDMA/srp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/9c5274eec75b
[10/52] zfcp: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/d78f31ce7ef9
[11/52] 53c700: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/cd4b46cdb491
[12/52] NCR5380: Use sc_data_direction instead of rq_data_dir()
        https://git.kernel.org/mkp/scsi/c/2e4b231ac125
[13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/8779b4bdbc12
[14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/40e16ce7b6fa
[15/52] aha1542: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/11bf4ec58073
[16/52] bnx2i: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/4bfb9809b877
[17/52] csiostor: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/c14f1fee18f0
[18/52] cxlflash: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/d3e16aecea2b
[19/52] dpt_i2o: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/3ada9c791b1d
[20/52] fnic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/e1c9f0cfac4f
[21/52] hisi_sas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/1effbface967
[22/52] hpsa: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/84090d42c437
[23/52] ibmvfc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/e9ddad785ec2
[24/52] ibmvscsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/0cd75102014b
[25/52] ips: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/240ec1197786
[26/52] libsas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/cad1a780e065
[27/52] lpfc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/4221c8a4bdd3
[28/52] megaraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/4bccecf1c9a9
[29/52] mpi3mr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/69868c3b6939
[30/52] mpt3sas: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/24b3c922bc83
[31/52] mvumi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/ce425dd7dbc9
[32/52] myrb: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/2fd8f23aae36
[33/52] myrs: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/43b2d1b14ed0
[34/52] ncr53c8xx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/0f8f3ea84a89
[35/52] qedf: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/d995da612286
[36/52] qedi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/44656cfb0102
[37/52] qla1280: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/3f5e62c5e074
[38/52] qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/c7d6b2c2cd56
[39/52] qla4xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/924b3d7a3a74
[40/52] qlogicpti: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/ba4baf0951bb
[41/52] scsi_debug: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/a6e76e6f2c0e
[42/52] smartpqi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/12db0f9347ad
[43/52] snic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/ec808ef9b838
[44/52] stex: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/bbfa8d7d1283
[45/52] sun3_scsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/6c5d5422c533
[46/52] sym53c8xx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/77ff7756c73e
[47/52] ufs: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/3f2c1002e0fc
[48/52] virtio_scsi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/7cc4554ef2c2
[49/52] xen-scsifront: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/80ca10b6052d
[50/52] tcm_loop: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/cb22f89e7a12
[51/52] usb-storage: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
        https://git.kernel.org/mkp/scsi/c/9c4a6d528185
[52/52] core: Remove the request member from struct scsi_cmnd
        https://git.kernel.org/mkp/scsi/c/2266a2def97c

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v5 49/52] xen-scsifront: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  2021-08-09 23:03 ` [PATCH v5 49/52] xen-scsifront: " Bart Van Assche
@ 2021-08-17 12:42   ` Juergen Gross
  0 siblings, 0 replies; 87+ messages in thread
From: Juergen Gross @ 2021-08-17 12:42 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Boris Ostrovsky, James E.J. Bottomley


[-- Attachment #1.1.1: Type: text/plain, Size: 290 bytes --]

On 10.08.21 01:03, 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: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

end of thread, other threads:[~2021-08-17 12:42 UTC | newest]

Thread overview: 87+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 23:03 [PATCH v5 00/52] Remove the request pointer from struct scsi_cmnd Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 01/52] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
2021-08-10  6:15   ` Hannes Reinecke
2021-08-12 12:28   ` Christoph Hellwig
2021-08-12 18:19     ` Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 02/52] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
2021-08-10  6:17   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 03/52] sd: " Bart Van Assche
2021-08-10  6:18   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 04/52] sr: " Bart Van Assche
2021-08-10  6:18   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 05/52] scsi_transport_fc: " Bart Van Assche
2021-08-10  6:19   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 06/52] scsi_transport_spi: " Bart Van Assche
2021-08-10  6:19   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 07/52] ata: " Bart Van Assche
2021-08-10  6:20   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 08/52] RDMA/iser: " Bart Van Assche
2021-08-10  6:20   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 09/52] RDMA/srp: " Bart Van Assche
2021-08-10  6:21   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 10/52] zfcp: " Bart Van Assche
2021-08-10  6:21   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 11/52] 53c700: " Bart Van Assche
2021-08-10  6:21   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 12/52] NCR5380: Use sc_data_direction instead of rq_data_dir() Bart Van Assche
2021-08-10  6:22   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 13/52] aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
2021-08-10  6:23   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 14/52] advansys: " Bart Van Assche
2021-08-10  6:25   ` Hannes Reinecke
2021-08-10 16:16     ` Bart Van Assche
2021-08-12  2:58       ` Martin K. Petersen
2021-08-12  4:03         ` Bart Van Assche
2021-08-12  6:03         ` Hannes Reinecke
2021-08-12  9:05           ` John Garry
2021-08-13  1:42             ` Bart Van Assche
2021-08-13  2:19         ` Matthew Wilcox
2021-08-10 17:25     ` Matthew Wilcox
2021-08-09 23:03 ` [PATCH v5 15/52] aha1542: " Bart Van Assche
2021-08-10  6:25   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 16/52] bnx2i: " Bart Van Assche
2021-08-10  6:26   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 17/52] csiostor: " Bart Van Assche
2021-08-10  6:26   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 18/52] cxlflash: " Bart Van Assche
2021-08-10  6:27   ` Hannes Reinecke
2021-08-09 23:03 ` [PATCH v5 19/52] dpt_i2o: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 20/52] fnic: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 21/52] hisi_sas: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 22/52] hpsa: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 23/52] ibmvfc: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 24/52] ibmvscsi: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 25/52] ips: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 26/52] libsas: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 27/52] lpfc: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 28/52] megaraid: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 29/52] mpi3mr: " Bart Van Assche
2021-08-16  8:32   ` Kashyap Desai
2021-08-16 17:13     ` Martin K. Petersen
2021-08-09 23:03 ` [PATCH v5 30/52] mpt3sas: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 31/52] mvumi: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 32/52] myrb: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 33/52] myrs: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 34/52] ncr53c8xx: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 35/52] qedf: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 36/52] qedi: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 37/52] qla1280: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 38/52] qla2xxx: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 39/52] qla4xxx: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 40/52] qlogicpti: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 41/52] scsi_debug: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 42/52] smartpqi: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 43/52] snic: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 44/52] stex: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 45/52] sun3_scsi: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 46/52] sym53c8xx: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 47/52] ufs: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 48/52] virtio_scsi: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 49/52] xen-scsifront: " Bart Van Assche
2021-08-17 12:42   ` Juergen Gross
2021-08-09 23:03 ` [PATCH v5 50/52] tcm_loop: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 51/52] usb-storage: " Bart Van Assche
2021-08-09 23:03 ` [PATCH v5 52/52] core: Remove the request member from struct scsi_cmnd Bart Van Assche
2021-08-10  5:28 ` [PATCH v5 00/52] Remove the request pointer " Martin K. Petersen
2021-08-10 16:19   ` Bart Van Assche
2021-08-17  3:17 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.