From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: 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 v2 35/84] fnic: Call scsi_done() directly
Date: Wed, 29 Sep 2021 15:05:11 -0700 [thread overview]
Message-ID: <20210929220600.3509089-36-bvanassche@acm.org> (raw)
In-Reply-To: <20210929220600.3509089-1-bvanassche@acm.org>
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/fnic/fnic_scsi.c | 119 +++++++++++++++-------------------
1 file changed, 54 insertions(+), 65 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index f8afbfb468dc..09b8bf5adaf5 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -560,7 +560,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
CMD_STATE(sc) = FNIC_IOREQ_CMD_PENDING;
CMD_SP(sc) = (char *)io_req;
CMD_FLAGS(sc) |= FNIC_IO_INITIALIZED;
- sc->scsi_done = done;
/* create copy wq desc and enqueue it */
wq = &fnic->wq_copy[0];
@@ -1051,8 +1050,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
}
/* Call SCSI completion function to complete the IO */
- if (sc->scsi_done)
- sc->scsi_done(sc);
+ scsi_done(sc);
}
/* fnic_fcpio_itmf_cmpl_handler
@@ -1193,28 +1191,25 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
fnic_release_ioreq_buf(fnic, io_req, sc);
mempool_free(io_req, fnic->io_req_pool);
- if (sc->scsi_done) {
- FNIC_TRACE(fnic_fcpio_itmf_cmpl_handler,
- sc->device->host->host_no, id,
- sc,
- jiffies_to_msecs(jiffies - start_time),
- desc,
- (((u64)hdr_status << 40) |
- (u64)sc->cmnd[0] << 32 |
- (u64)sc->cmnd[2] << 24 |
- (u64)sc->cmnd[3] << 16 |
- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
- (((u64)CMD_FLAGS(sc) << 32) |
- CMD_STATE(sc)));
- sc->scsi_done(sc);
- atomic64_dec(&fnic_stats->io_stats.active_ios);
- if (atomic64_read(&fnic->io_cmpl_skip))
- atomic64_dec(&fnic->io_cmpl_skip);
- else
- atomic64_inc(&fnic_stats->io_stats.io_completions);
- }
+ FNIC_TRACE(fnic_fcpio_itmf_cmpl_handler,
+ sc->device->host->host_no, id,
+ sc,
+ jiffies_to_msecs(jiffies - start_time),
+ desc,
+ (((u64)hdr_status << 40) |
+ (u64)sc->cmnd[0] << 32 |
+ (u64)sc->cmnd[2] << 24 |
+ (u64)sc->cmnd[3] << 16 |
+ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
+ (((u64)CMD_FLAGS(sc) << 32) |
+ CMD_STATE(sc)));
+ scsi_done(sc);
+ atomic64_dec(&fnic_stats->io_stats.active_ios);
+ if (atomic64_read(&fnic->io_cmpl_skip))
+ atomic64_dec(&fnic->io_cmpl_skip);
+ else
+ atomic64_inc(&fnic_stats->io_stats.io_completions);
}
-
} else if (id & FNIC_TAG_DEV_RST) {
/* Completion of device reset */
CMD_LR_STATUS(sc) = hdr_status;
@@ -1421,23 +1416,22 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
atomic64_inc(&fnic_stats->io_stats.io_completions);
/* Complete the command to SCSI */
- if (sc->scsi_done) {
- 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",
- tag, sc);
-
- FNIC_TRACE(fnic_cleanup_io,
- 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 |
- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
- (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
-
- sc->scsi_done(sc);
- }
+ 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",
+ tag, sc);
+
+ FNIC_TRACE(fnic_cleanup_io,
+ 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 |
+ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
+ (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
+
+ scsi_done(sc);
+
return true;
}
@@ -1495,17 +1489,15 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "wq_copy_cleanup_handler:"
" DID_NO_CONNECT\n");
- if (sc->scsi_done) {
- FNIC_TRACE(fnic_wq_copy_cleanup_handler,
- sc->device->host->host_no, id, sc,
- jiffies_to_msecs(jiffies - start_time),
- 0, ((u64)sc->cmnd[0] << 32 |
- (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 |
- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
- (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
+ FNIC_TRACE(fnic_wq_copy_cleanup_handler,
+ sc->device->host->host_no, id, sc,
+ jiffies_to_msecs(jiffies - start_time),
+ 0, ((u64)sc->cmnd[0] << 32 |
+ (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 |
+ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
+ (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
- sc->scsi_done(sc);
- }
+ scsi_done(sc);
}
static inline int fnic_queue_abort_io_req(struct fnic *fnic, int tag,
@@ -1931,16 +1923,14 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
fnic_release_ioreq_buf(fnic, io_req, sc);
mempool_free(io_req, fnic->io_req_pool);
- if (sc->scsi_done) {
/* Call SCSI completion function to complete the IO */
- sc->result = (DID_ABORT << 16);
- sc->scsi_done(sc);
- atomic64_dec(&fnic_stats->io_stats.active_ios);
- if (atomic64_read(&fnic->io_cmpl_skip))
- atomic64_dec(&fnic->io_cmpl_skip);
- else
- atomic64_inc(&fnic_stats->io_stats.io_completions);
- }
+ sc->result = DID_ABORT << 16;
+ scsi_done(sc);
+ atomic64_dec(&fnic_stats->io_stats.active_ios);
+ if (atomic64_read(&fnic->io_cmpl_skip))
+ atomic64_dec(&fnic->io_cmpl_skip);
+ else
+ atomic64_inc(&fnic_stats->io_stats.io_completions);
fnic_abort_cmd_end:
FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, tag, sc,
@@ -2153,11 +2143,10 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,
* Any IO is returned during reset, it needs to call scsi_done
* to return the scsi_cmnd to upper layer.
*/
- if (sc->scsi_done) {
- /* Set result to let upper SCSI layer retry */
- sc->result = DID_RESET << 16;
- sc->scsi_done(sc);
- }
+ /* Set result to let upper SCSI layer retry */
+ sc->result = DID_RESET << 16;
+ scsi_done(sc);
+
return true;
}
next prev parent reply other threads:[~2021-09-29 22:07 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 22:04 [PATCH v2 00/84] Call scsi_done() directly Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 01/84] scsi: core: Use a member variable to track the SCSI command submitter Bart Van Assche
2021-10-01 15:57 ` Benjamin Block
2021-10-03 21:08 ` Bean Huo
2021-09-29 22:04 ` [PATCH v2 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it Bart Van Assche
2021-10-03 21:10 ` Bean Huo
2021-09-29 22:04 ` [PATCH v2 03/84] ata: Call scsi_done() directly Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 04/84] firewire: sbp2: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 05/84] ib_srp: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 06/84] message: fusion: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 07/84] zfcp_scsi: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 08/84] 3w-9xxx: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 09/84] 3w-sas: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 10/84] 3w-xxxx: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 11/84] 53c700: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 12/84] BusLogic: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 13/84] NCR5380: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 14/84] a100u2w: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 15/84] aacraid: Introduce aac_scsi_done() Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 16/84] aacraid: Call scsi_done() directly Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 17/84] acornscsi: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 18/84] advansys: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 19/84] aha152x: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 20/84] aha1542: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 21/84] aic7xxx: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 22/84] arcmsr: " Bart Van Assche
2021-09-29 22:04 ` [PATCH v2 23/84] atp870u: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 24/84] bfa: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 25/84] bnx2fc: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 26/84] csiostor: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 27/84] cxlflash: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 28/84] dc395x: " Bart Van Assche
2021-09-30 10:26 ` Oliver Neukum
2021-09-30 16:04 ` Bart Van Assche
2021-10-04 9:44 ` Oliver Neukum
2021-10-04 16:23 ` Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 29/84] dpt_i2o: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 30/84] esas2r: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 31/84] esp_scsi: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 32/84] fas216: Introduce struct fas216_cmd_priv Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 33/84] fas216: Stop using scsi_cmnd.scsi_done Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 34/84] fdomain: Call scsi_done() directly Bart Van Assche
2021-09-29 22:05 ` Bart Van Assche [this message]
2021-09-29 22:05 ` [PATCH v2 36/84] hpsa: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 37/84] hptiop: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 38/84] ibmvscsi: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 39/84] imm: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 40/84] initio: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 41/84] ipr: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 42/84] ips: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 43/84] libfc: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 44/84] libiscsi: " Bart Van Assche
2021-10-05 23:52 ` Lee Duncan
2021-09-29 22:05 ` [PATCH v2 45/84] libsas: " Bart Van Assche
2021-09-30 18:08 ` John Garry
2021-09-30 18:20 ` Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 46/84] lpfc: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 47/84] mac53c94: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 48/84] megaraid: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 49/84] " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 50/84] mesh: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 51/84] mpi3mr: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 52/84] mpt3sas: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 53/84] mvumi: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 54/84] myrb: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 55/84] myrs: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 56/84] ncr53c8xx: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 57/84] nsp32: " Bart Van Assche
2021-10-04 4:15 ` Masanori Goto
2021-10-04 16:28 ` Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 58/84] pcmcia: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 59/84] pmcraid: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 60/84] ppa: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 61/84] ps3rom: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 62/84] qedf: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 63/84] qla1280: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 64/84] qla2xxx: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 65/84] qla4xxx: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 66/84] qlogicfas408: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 67/84] qlogicpti: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 68/84] scsi_debug: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 69/84] smartpqi: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 70/84] snic: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 71/84] stex: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 72/84] storvsc_drv: " Bart Van Assche
2021-09-30 17:57 ` Haiyang Zhang
2021-10-06 12:00 ` Wei Liu
2021-10-06 22:11 ` Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 73/84] sym53c8xx_2: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 74/84] ufs: " Bart Van Assche
2021-10-03 21:10 ` Bean Huo
2021-09-29 22:05 ` [PATCH v2 75/84] virtio_scsi: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 76/84] vmw_pvscsi: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 77/84] wd33c93: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 78/84] wd719x: " Bart Van Assche
2021-09-29 22:05 ` [PATCH v2 79/84] xen-scsifront: " Bart Van Assche
2021-09-29 22:11 ` [PATCH v2 80/84] staging: rts5208: " Bart Van Assche
2021-09-29 22:11 ` [PATCH v2 81/84] staging: unisys: visorhba: " Bart Van Assche
2021-09-30 6:00 ` Greg Kroah-Hartman
2021-09-29 22:11 ` [PATCH v2 82/84] target/tcm_loop: " Bart Van Assche
2021-09-29 22:11 ` [PATCH v2 83/84] usb: " Bart Van Assche
2021-09-29 22:11 ` [PATCH v2 84/84] scsi: core: Call scsi_done directly Bart Van Assche
2021-10-03 21:14 ` Bean Huo
2021-09-30 7:25 ` [PATCH v2 00/84] Call scsi_done() directly Bean Huo
2021-09-30 16:07 ` 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=20210929220600.3509089-36-bvanassche@acm.org \
--to=bvanassche@acm.org \
--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