From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Satish Kharat <satishkh@cisco.com>,
Sesidhar Baddela <sebaddel@cisco.com>,
Karan Tilak Kumar <kartilak@cisco.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH v3 20/51] fnic: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
Date: Sun, 23 May 2021 20:08:25 -0700 [thread overview]
Message-ID: <20210524030856.2824-21-bvanassche@acm.org> (raw)
In-Reply-To: <20210524030856.2824-1-bvanassche@acm.org>
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 | 49 +++++++++++++++++------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 762cc8bd2653..ee02f5ed90ee 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 *))
{
+ struct request *rq = scsi_cmd_to_rq(sc);
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));
+ rq->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,
+ rq->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,
+ rq->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)
{
+ struct request *rq = scsi_cmd_to_rq(sc);
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, rq->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));
+ rq->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);
+ rq->tag, sc);
FNIC_TRACE(fnic_cleanup_io,
- sc->device->host->host_no, sc->request->tag, sc,
+ 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 |
@@ -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 *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;
+ 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,7 +1842,7 @@ 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,
+ if (fnic_queue_abort_io_req(fnic, rq->tag, task_req,
fc_lun.scsi_lun, io_req)) {
spin_lock_irqsave(io_lock, flags);
if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING)
@@ -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, 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 |
@@ -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 |
next prev parent reply other threads:[~2021-05-24 3:09 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 3:08 [PATCH v3 00/51] Remove the request pointer from struct scsi_cmnd Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 01/51] core: Introduce the scsi_cmd_to_rq() function Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 02/51] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 03/51] sd: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 04/51] sr: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 05/51] scsi_transport_fc: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 06/51] scsi_transport_spi: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 07/51] ata: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 08/51] RDMA/iser: " Bart Van Assche
2021-05-24 8:46 ` Max Gurtovoy
2021-05-24 3:08 ` [PATCH v3 09/51] RDMA/srp: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 10/51] zfcp: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 11/51] 53c700: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 12/51] NCR5380: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 13/51] aacraid: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 14/51] advansys: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 15/51] aha1542: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 16/51] bnx2i: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 17/51] csiostor: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 18/51] cxlflash: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 19/51] dpt_i2o: " Bart Van Assche
2021-05-24 3:08 ` Bart Van Assche [this message]
2021-05-24 3:08 ` [PATCH v3 21/51] hisi_sas: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 22/51] hpsa: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 23/51] ibmvfc: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 24/51] ibmvscsi: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 25/51] ips: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 26/51] libsas: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 27/51] lpfc: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 28/51] megaraid: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 29/51] mpt3sas: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 30/51] mvumi: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 31/51] myrb: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 32/51] myrs: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 33/51] ncr53c8xx: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 34/51] qedf: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 35/51] qedi: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 36/51] qla1280: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 37/51] qla2xxx: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 38/51] qla4xxx: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 39/51] qlogicpti: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 40/51] scsi_debug: " Bart Van Assche
2021-05-25 16:19 ` Douglas Gilbert
2021-05-24 3:08 ` [PATCH v3 41/51] smartpqi: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 42/51] snic: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 43/51] stex: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 44/51] sun3_scsi: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 45/51] sym53c8xx: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 46/51] ufs: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 47/51] virtio_scsi: " Bart Van Assche
2021-05-24 9:23 ` Michael S. Tsirkin
2021-05-24 3:08 ` [PATCH v3 48/51] xen-scsifront: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 49/51] tcm_loop: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 50/51] usb-storage: " Bart Van Assche
2021-05-24 3:08 ` [PATCH v3 51/51] core: Remove the request member from struct scsi_cmnd Bart Van Assche
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=20210524030856.2824-21-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=jejb@linux.ibm.com \
--cc=kartilak@cisco.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=satishkh@cisco.com \
--cc=sebaddel@cisco.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox