All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Bart Van Assche <bvanassche@acm.org>
Cc: <linux-scsi@vger.kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	"Hannes Reinecke" <hare@suse.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: Re: [PATCH v5 14/52] advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
Date: Thu, 12 Aug 2021 10:05:02 +0100	[thread overview]
Message-ID: <798dbe0f-8ad0-6aa8-39e6-059dea4267b3@huawei.com> (raw)
In-Reply-To: <a8d96139-dcff-d37e-06fa-c2e46c75a309@suse.de>

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!

  reply	other threads:[~2021-08-12  9:05 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=798dbe0f-8ad0-6aa8-39e6-059dea4267b3@huawei.com \
    --to=john.garry@huawei.com \
    --cc=bvanassche@acm.org \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.